Thursday, February 18, 2010

Script: Some useful batch file commands

Get directory where batch file is located

Use %~dp0 to get the directory of the batch file. Example, to change the current directory to that of the batch file: CD /d "%~dp0"

Redirect stdouput and stderror to single file

e.g. auditpol.exe /backup /file:c:\nofolder\auditbackup.csv > c:\abc.txt 2>&1

No comments:

Post a Comment