我使用这个脚本
$date = Get-Date
Get-Childitem -name | where {$_.CreationTime -eq "$date"}
但它不工作。 所有我需要的是做一个布尔检查是否有在特定日期创建的文件。 谢谢。
我使用这个脚本
$date = Get-Date
Get-Childitem -name | where {$_.CreationTime -eq "$date"}
但它不工作。 所有我需要的是做一个布尔检查是否有在特定日期创建的文件。 谢谢。
Get-Date
获取当前日期和时间。 如果你比较文件的创建日期与当前日期和时间,你不会找到任何文件(除了您刚才已创建了一个在检索当前日期;))。
$today = (get-date).Date
Get-ChildItem | where { $_.CreationTime.Date -eq $today }
Get-ChildItem | where-object { $_.CreationTime.Date -match "2014" }
其中, 2014
是创造的一年。