3テラバイト

プログラム関連備忘録サイト。主にゲーム。

PowerShell

PowerShellでアイテムのプロパティを設定するコマンドレットSet-ItemPropertyの使い方

投稿日:

こんにちは、今日はPowerShellでアイテムのプロパティを設定するコマンドレットSet-ItemPropertyの使い方についてまとめていきます。

確認環境

PSVersion 5.1.18362.1110

Set-ItemPropertyの使い方

引数にアイテムを指定し、-Nameオプションで変更するプロパティを、-Valueオプションでその値を指定します。

この例では緩れとディレクトリにある「test.txt」ファイルを読み取り専用に設定しています。

PS C:\Users\santerabyte> Set-ItemProperty .\test.txt -Name IsReadOnly -Value $true

リンク

Set-ItemProperty (Microsoft.PowerShell.Management) – PowerShell | Microsoft Docs
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/set-itemproperty?view=powershell-7.1

-PowerShell


comment

メールアドレスが公開されることはありません。 が付いている欄は必須項目です


reCaptcha の認証期間が終了しました。ページを再読み込みしてください。

関連記事

no image

PowerShellで特定ディレクトリのファイル内文字列を置換する

Get-ChildItem . | ForEach-Object {Get-Content -Encoding utf8 $_ | ForEach-Object {$_ -creplace &#039 …

no image

PowerShellでアイテムのプロパティを取得するコマンドレットGet-ItemPropertyの使い方

こんにちは、今日はPowerShellでアイテムのプロパティを取得するコマンドレットGet-ItemPropertyの使い方についてまとめていきます。 確認環境 PSVersion 5.1.18362 …

no image

PowerShellで実行ポリシーを設定するコマンドレットSet-ExecutionPolicyの使い方

こんにちは、今日はPowerShellで実行ポリシーを設定するコマンドレットSet-ExecutionPolicyの使い方についてまとめていきます。 確認環境 PSVersion 5.1.18362. …

no image

Windows10でPowerShellスクリプトをスケジュール実行する

こんにちは、今日はWindows10でPowerShellスクリプトを自動実行する方法についてまとめていきます。 自動実行設定 Windows10でPowerShellスクリプトを自動実行するには、タ …

no image

PowerShellでWebリクエストを実行するコマンドレットInvoke-WebRequestの使い方

こんにちは、今日はPowerShellでWebリクエストを実行するコマンドレットInvoke-WebRequestの使い方についてまとめていきます。 確認環境 PSVersion 5.1.18362. …