本文发表在 rolia.net 枫下论坛The Windows 2000 Resource Kits and Supplement One contains the FORFILES command, and an updated version is built into Windows .NET Server.
When you type FORFILES at a CMD prompt, you receive:
FORFILES v 1.1 - emmanubo@microsoft.com - 4/98
Syntax : FORFILES [-pPath] [-mSearch Mask] [-ccommand] [-d<+|->] [-s]
-pPath Path where to start searching
-mSearch Mask Search files according to
-cCommand Command to execute on each file(s)
-d<+|-> Select files with date >= or <=DDMMYYYY (UTC)
or files having date >= or <= (current date - DD days)
-s Recurse directories
-v Verbose mode
The following variables can be used in Command :
@FILE, @FNAME_WITHOUT_EXT, @EXT, @PATH, @RELPATH, @ISDIR, @FSIZE, @FDATE,
@FTIME
To include special hexa characters in the command line : use 0xHH
Default :
Examples :
FORFILES -pc:\ -s -m*.BAT -c"CMD /C Echo @FILE is a batch file"
FORFILES -pc:\ -s -m*.* -c"CMD /C if @ISDIR==TRUE echo @FILE is a directory"
FORFILES -pc:\ -s -m*.* -d-100 -c"CMD /C Echo @FILE : date >= 100 days"
FORFILES -pc:\ -s -m*.* -d-01011993 -c"CMD /C Echo @FILE is quite old!"
FORFILES -pc:\ -s -m*.* -c"CMD /c echo extension of @FILE is 0x22@EXT0x22"更多精彩文章及讨论,请光临枫下论坛 rolia.net
When you type FORFILES at a CMD prompt, you receive:
FORFILES v 1.1 - emmanubo@microsoft.com - 4/98
Syntax : FORFILES [-pPath] [-mSearch Mask] [-ccommand] [-d<+|->] [-s]
-pPath Path where to start searching
-mSearch Mask Search files according to
-cCommand Command to execute on each file(s)
-d<+|-> Select files with date >= or <=DDMMYYYY (UTC)
or files having date >= or <= (current date - DD days)
-s Recurse directories
-v Verbose mode
The following variables can be used in Command :
@FILE, @FNAME_WITHOUT_EXT, @EXT, @PATH, @RELPATH, @ISDIR, @FSIZE, @FDATE,
@FTIME
To include special hexa characters in the command line : use 0xHH
Default :
Examples :
FORFILES -pc:\ -s -m*.BAT -c"CMD /C Echo @FILE is a batch file"
FORFILES -pc:\ -s -m*.* -c"CMD /C if @ISDIR==TRUE echo @FILE is a directory"
FORFILES -pc:\ -s -m*.* -d-100 -c"CMD /C Echo @FILE : date >= 100 days"
FORFILES -pc:\ -s -m*.* -d-01011993 -c"CMD /C Echo @FILE is quite old!"
FORFILES -pc:\ -s -m*.* -c"CMD /c echo extension of @FILE is 0x22@EXT0x22"更多精彩文章及讨论,请光临枫下论坛 rolia.net