Powershell-如何检查具有所需创建时间的文件是否存在?

Powershell-如何检查具有所需创建时间的文件是否存在?,powershell,powershell-2.0,Powershell,Powershell 2.0,我正在使用这个脚本 $date = Get-Date Get-Childitem -name | where {$_.CreationTime -eq "$date"} 但它不起作用。我所需要做的就是做一个布尔检查,看看是否有一个在特定日期创建的文件。谢谢。获取日期获取当前日期和时间。如果将文件的创建日期与当前日期和时间进行比较,则找不到任何文件(检索当前日期时创建的文件除外) 其中,2014是创建之年 $today = (get-date).Date Get-ChildItem | wher

我正在使用这个脚本

$date = Get-Date
Get-Childitem -name | where {$_.CreationTime -eq "$date"}

但它不起作用。我所需要做的就是做一个布尔检查,看看是否有一个在特定日期创建的文件。谢谢。

获取日期获取当前日期和时间。如果将文件的创建日期与当前日期和时间进行比较,则找不到任何文件(检索当前日期时创建的文件除外)

其中,
2014
是创建之年

$today = (get-date).Date
Get-ChildItem | where { $_.CreationTime.Date -eq $today }
Get-ChildItem | where-object { $_.CreationTime.Date -match "2014" }