A. Windows NT 4.0 introduced several extensions to cmd.exe. Use these extensions to ensure that the HKEY_CURRENT_USER\Software\Microsoft\Command Processor\EnableExtensions registry entry is set to 1.
The following table lists the most commonly used commands.
|call <batch file>||Calls one batch file from inside another. The current batch file’s execution is suspended until the called batch file completes.|
|exit||Stops a batch file from running. If one batch file calls another, exit stops both batch files.|
|findstr <string> <filename(s)>||Finds a string in a file. This powerful command has several parameters.|
|for||Standard for loop. The command |
for /L %n IN (1,1,10) DO @ECHO %nWould print 1 to 10.
|goto <label>||Causes a program’s execution to skip to a given point. A colon must precede the label name. For example, |
goto label1<br> ...<br> :label1<br> ...
|if <condition> ..||The if statement has a lot of functionality. Common uses include the following. |
if /i <string1> <compare> <string2> <command>The /i parameter makes the comparison case-insensitive. The comparison can be one of the following.
LEQ—less than or equal
GEQ—greater than or equal
if errorlevel<br> if exist <file name>
|rem <string>||A comment.|
|start <window title> <command>||Starts a new command session and runs a given command. Unlike with the call command, the current batch file’s execution continues.|
Learn more: Resource Kit Batch File Commands
The Microsoft Windows NT Resource Kit includes some additional utilities that you might find useful.