Set a variable: Refer to a variable: Command line arguments are variables Check if a variable is defined: Check a result code from the last executed command: Do things in a loop: Execute another script: Check if directory exists: Here's an example of a batch file that does a few common things: @ECHO OFF @rem "pushd $dir" puts $dir on directory stack pushd . SET COMMENT=%1 IF NOT DEFINED COMMENT SET COMMENT="" SET FOO="bar" IF %FOO%=="bar" goto IS_BAR echo The above should always be true goto END :IS_BAR nmake -f Makefile.vc IF ERRORLEVEL 1 goto ERR_ONE_OR_HIGHER echo Compilation successful! goto END :ERR_ONE_OR_HIGHER echo Compilation failed! goto END :END @rem popd pops the directory name from the stack and does cd there popd |