如何在 PowerShell 中使用 Get-ChildItem 获取只读文件?

powershellmicrosoft technologiessoftware & coding

要在 PowerShell 中使用 Get-ChildItem 获取只读文件,您需要使用 –Readonly 文件。只读文件具有属性"r"。

在下面的示例中,您可以检查文件的属性。

Get-ChildItem D:\Temp\ -ReadOnly

输出

PS C:\WINDOWS\system32> Get-ChildItem D:\Temp\* -ReadOnly
    Directory: D:\Temp
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-ar---       13-01-2020     18:19              0 Readonlyfile.txt

您可以在 Mode 属性中检查只读属性值。


相关文章