隐藏文件时Powershell中的文件属性

时间:2017-06-23 15:13:14

标签: powershell attributes hidden

$writetime = Get-ChildItem "\\$computer\$searchpath\$searchfile" | Foreach {$_.LastWriteTime}

使用上面的代码,我尝试获取文件的LastWriteTime,但是如果文件被隐藏:

enter image description here

然后它无法返回LastWriteTime。有没有办法迫使它得到我想要的东西而不管它在系统上的隐藏状态?

1 个答案:

答案 0 :(得分:3)

使用-Force上的Get-ChildItem参数:

Get-ChildItem "\\$computer\$searchpath\$searchfile" -Force