$writetime = Get-ChildItem "\\$computer\$searchpath\$searchfile" | Foreach {$_.LastWriteTime}
使用上面的代码,我尝试获取文件的LastWriteTime,但是如果文件被隐藏:
然后它无法返回LastWriteTime。有没有办法迫使它得到我想要的东西而不管它在系统上的隐藏状态?
答案 0 :(得分:3)
使用-Force
上的Get-ChildItem
参数:
Get-ChildItem "\\$computer\$searchpath\$searchfile" -Force