我正在尝试使用批处理来检查文件是否今天被修改。
你能帮我解释一下吗? 下面是我正在面对一些问题的代码。
SET filename="D:\empty\xyz.txt" forfiles /m %filename% /d 0 && ( echo The file was modified today ) || ( echo The file has not been modified today )
/Msearch掩码中不能包含path。 您需要使用/Ppath参数。
C:\> REM This does not work C:\> SET FILENAME=D:\empty\xyz.txt C:\> FORFILES /M %FILENAME% ERROR: Files of type "D:\empty\xyz.txt" not found. C:\> REM This does work C:\> SET FILENAME=xyz.txt C:\> FORFILES /P "D:\empty" /M %FILENAME% "xyz.txt"
有关更多详细信息,请参阅Forfiles文档 。