ファイル属性操作隠し属性ファイル・フォルダの表示dir -Hidden # 隠し属性のファイルのみ表示 dir -Force # すべてのファイルの表示 ファイル属性の付与$file = get-item foo.txt $file.Attributes = 'Hidden' # foo.txtの属性は隠しファイルになる 複数の属性を付与$file.Attributes = 'Hidden', 'ReadOnly' ファイル属性の削除$file = get-item -Force foo.txt # 隠しファイルをget-itemするには-Forceが必要 $file.Attributes = '' # すべての属性が削除された $file.Attributes = 'Normal' # 上と同じ動作で、すべての属性が削除される 隠しファイル属性のみ削除$file.Attributes -= 'Hidden' ファイル属性の確認$(get-item -Force foo.txt).Attributes 既定のファイル属性一覧[enum]::GetNames("system.io.fileattributes") ReadOnly Hidden System Directory Archive Device Normal Temporary SparseFile ReparsePoint Compressed Offline NotContentIndexed Encrypted IntegrityStream NoScrubData 参考https://msdn.microsoft.com/en-us/library/system.io.fileattributes%28v=vs.110%29.aspx 参考 |
|