2017-06-23 19 views
-1
$writetime = Get-ChildItem "\\$computer\$searchpath\$searchfile" | Foreach {$_.LastWriteTime} 

使用上面的代码中,我试图得到一个文件的LastWriteTime,但如果该文件是隐藏的:文件在PowerShell中的属性,当文件被隐藏

enter image description here

然后它不能返回LastWriteTime。有没有办法强制它得到我想要的,而不管它在系统上的隐藏状态?

+1

尝试'GET-ChildItem -Force \\服务器\路径\为\ files' – arco444

回答

3

使用-Force参数上Get-ChildItem

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

......说了绝地。 – thepip3r