22nd February 2011

Batch Reference

Backticks

Store output of command whoami.exe in environment variable TEST:

for /F "tokens=1 delims=" %%i in ('whoami.exe') do set TEST=%%i

Percent Handling

Use %i when directly using cmd.exe in interactive mode, and %%i when in a batch script.


Back to Knowledge Base.