-Date : This can be
+DDMMYY to select files newer than a given date
(filedate >=DDMMYY) or
-DDMMYY to select files older than a given date
(filedate <=DDMMYY) or
+DD to select files newer than DD days ago or
-DD to select files older than DD days ago
-Mask : Search mask (wildcards allowed) default=*.*
-Command : Command to execute on each file. default="CMD /C Echo @FILE"
-v : Verbose report
The following variables can be used in -cCommand (must be upper case)
@FILE,
@FNAME_WITHOUT_EXT,
@EXT,
@PATH,
@RELPATH,
@ISDIR,
@FSIZE,
@FDATE,
@FTIME
To ECHO Hex characters in the Command use: 0xHH
Examples:
To find every text file on the C: driveFORFILES -pC:\ -s -m*.TXT -c"CMD /C Echo @FILE is a text file"To show the path of every HTML file on the C: drive
FORFILES -pC:\ -s -m*.HTML -c"CMD /C Echo @RELPATH is the location of @FILE"List every folder on the C: driveFORFILES -pC:\ -s -m*. -c"CMD /C if @ISDIR==TRUE echo @FILE is a folder"For every file on the C: drive list the file extension in double quotesFORFILES -pc:\ -s -m*.* -c"CMD /c echo extension of @FILE is 0x22@EXT0x22"
List every file on the C: drive last modified over 100 days ago
FORFILES -pc:\ -s -m*.* -d-100 -c"CMD /C Echo @FILE : date >= 100 days"Find files last modified before 01-Jan-1995
FORFILES -pc:\ -s -m*.* -d-010195 -c"CMD /C Echo @FILE is quite old!"
note:
'0x22' is hex 22 - the double quote character - put these around any long filenames作者: vkill 时间: 2007-6-17 20:01 怎么和 for 相似那?楼主貌似不常用for作者: wangjf 时间: 2007-6-18 10:34 Windows2003 SP2中的FORFILES.EXE文件的帮助显示
Microsoft Windows [版本 5.2.3790]
(C) 版权所有 1985-2003 Microsoft Corp.