文件隐藏时Powershell中的文件属性
使用上面的代码,我尝试获取文件的LastWriteTime,但如果文件被隐藏:文件隐藏时Powershell中的文件属性,powershell,attributes,hidden,Powershell,Attributes,Hidden,使用上面的代码,我尝试获取文件的LastWriteTime,但如果文件被隐藏: 然后它无法返回LastWriteTime。有没有办法强迫它获得我想要的东西,而不管它在系统上的隐藏状态如何?使用-force上的get ChildItem参数: $writetime = Get-ChildItem "\\$computer\$searchpath\$searchfile" | Foreach {$_.LastWriteTime} “试试获取ChildItem-Force\\server\path
然后它无法返回LastWriteTime。有没有办法强迫它获得我想要的东西,而不管它在系统上的隐藏状态如何?使用
-force
上的get ChildItem
参数:
$writetime = Get-ChildItem "\\$computer\$searchpath\$searchfile" | Foreach {$_.LastWriteTime}
“试试
获取ChildItem-Force\\server\path\to\files
。”绝地武士说。
Get-ChildItem "\\$computer\$searchpath\$searchfile" -Force