Friday 30 November 2012

Windows script

To find files which last modified date is after 09/20/2012:
forfiles /s /m *.* /d 09/20/2012 /c "cmd /c echo @PATH @FDATE is new"

To find files which last modified date is before 09/20/2012:
forfiles /s /m *.* /d -09/20/2012 /c "cmd /c echo @PATH @FDATE is new"

To list all of the batch files on drive C:
forfiles /p c:\ /s /m *.bat /c "cmd /c echo @file is a batch file"

To list all of the directories on drive C
forfiles /p c:\ /s /m *.* /c "cmd /c if @isdir==true echo @file is a directory"

To list all of the files in the current directory that are at least one year old
forfiles /s /m *.* /d -365 /c "cmd /c echo @file is at least one year old."

To list the file name extensions of all the files in the current directory in column format, and add a tab before the extension
forfiles /s /m *.* /c "cmd /c echo The extension of @file is 0x09@ext"

No comments:

Post a Comment