获取与FORFILES最后访问日期

问题描述 投票:0回答:2

我需要得到FORFILES命令一些帮助:

forfiles /S /M "*.exe" /C "cmd /C echo @Path @ISDIR @Fdate @Ftime @Fsize" >> Output.txt
batch-file forfiles
2个回答
0
投票

最后访问日期是不是一件FORFILES产生。它可以在.bat文件脚本中使用PowerShell来完成。

powershell -NoProfile -Command ^
    "Get-ChildItem -Recurse -File -Filter '*.exe' |" ^
        "ForEach-Object {'""{0}""" {1} {2} {3}' -f @($_.FullName, $_.PSIsContainer, $_.LastAccessTime, $_.Length) }"

输出:

"C:\src\t\renexe\bar.exe" False 2018-02-16 02:19:51 6
"C:\src\t\renexe\baz.exe" False 2018-02-16 02:19:51 6
"C:\src\t\renexe\foo.exe" False 2018-02-16 02:19:51 6

0
投票

您可以使用dir命令助阵,这样的

forfiles /M *.xml /C "cmd /c dir /ta @file | findstr /R ^\d"  

其中,为方便起见,findstr过滤器。

© www.soinside.com 2019 - 2024. All rights reserved.