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 commandfor /L %n IN (1,1,10) DO @ECHO %n Would 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 |
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.EQU—equal NEQ—not equal LSS—less than LEQ—less than or equal GTR—greater than GEQ—greater than or equal if errorlevel |
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. |
The Microsoft Windows NT Resource Kit includes some additional utilities that you might find useful.
Няма коментари:
Публикуване на коментар