forfiles /p "C:FILEPATH\TO\BE\DELETED\User_1" /s /m *.* /c "cmd /c Del @path" /d -08
forfiles /p "C:FILEPATH\TO\BE\DELETED\User_2" /s /m *.* /c "cmd /c Del @path" /d -08
forfiles /p "C:FILEPATH\TO\BE\DELETED\User_3" /s /m *.* /c "cmd /c Del @path" /d -08
forfiles /p "C:FILEPATH\TO\BE\DELETED\User_4" /s /m *.* /c "cmd /c Del @path" /d -08
forfiles /p "C:FILEPATH\TO\BE\DELETED\User_5" /s /m *.* /c "cmd /c Del @path" /d -08
@echo off
@echo This purge was successfully completed on the date listed in the file name.
>purgelog_%date:~-10,2%%date:~-7,2%%date:~-4,4%_.txt
( command1
command2
...
commandN
)
How do I make this bat file output the results to a .txt file?
723 views Asked by Jay Newmz At
1
If this is stored in my.bat, simply use redirection.
If you also want stderr to go into the same file, use:
Note that this will not put the
purgelog*
information go into my.txt because its target file is explicitly specified.