Batch File Commands
Several CMD.EXE commands are particularly suited to batch file processing.
Here is a list of some of the commands you might find most useful:
ACTIVATE activates another window.
BEEP produces a sound of any pitch and duration through the
computer's speaker.
CALL executes one batch file from within another.
CANCEL terminates all batch file processing.
CLS and COLORset the screen display colors.
DO starts a loop. The loop can be based on a counter, or
on a conditional test like those used in IF and IFF.
DRAWBOX draws a box on the screen.
DRAWHLINE DRAWVLINEdraw horizontal and vertical lines on the
screen.
ECHO and ECHOSprint text on the screen (the text can also be
redirected to a file or device). ECHOERR and ECHOSERR
print text to the standard error device.
GOSUB executes a subroutine inside a batch file. The RETURN
command terminates the subroutine.
GOTO branches to a different location in the batch file.
FOR executes commands for each file that matches a set of
wildcards, or each entry in a list.
IF and IFF execute commands based on a test of string or numeric
values, program exit codes, or other conditions.
INKEY and INPUTcollect keyboard input from the user and store it
in environment variables.
KEYSTACK sends keystrokes to applications.
LOADBTM changes the batch file operating mode.
ON initializes error handling for Ctrl-C / Ctrl-Break, or
for program and command errors.
PAUSE displays a message and waits for the user to press a
key.
QUIT ends the current batch file and optionally returns an
exit code.
REM places a remark in a batch file.
SCREEN positions the cursor on the screen and optionally
prints a message at the new location.
SCRPUT displays a message in color.
SETLOCAL saves the current disk drive, default directory,
environment, alias list, and special character
settings. ENDLOCAL restores the settings that were
saved.
SHIFT changes the numbering of the batch file parameters.
START starts another session or window in certain
multitasking environments.
SWITCH selects a group of statements to execute based on the
value of a variable.
TEXT displays a block of text. ENDTEXT ends the block.
TIMER starts or reads a stopwatch.
TITLE changes the window title.
VSCRPUT displays a vertical message in color.
These commands, along with the internal variables and variable functions,
make the enhanced batch file language extremely powerful. Your copy of
CMD.EXE includes a sample batch file, in the file EXAMPLES.BTM, that
demonstrates some of the things you can do with batch files.
Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs