Sei sulla pagina 1di 2

Programming

Batch File Commands


@ %DIGIT %VARIABLE% CALL CLS

ECHO FOR GOTO IF PAUSE

REM SET SHIFT Miscellaneous

In DOS version 3.3 and later, hides the echo of a batch command. Any output generat the command is echoed. The at-sign can be prefixed to any DOS command, program or batch file name within a batch file. @[command]

examples

@ @echo OFF

{Seperates sections of the batch file without diplay the DOS prompt.} {Hides the echo off report.}

%DIGIT

Replaceable batch parameters which are defined by the user when the batch is execute parameters are separated by spaces, commas, or semicolons. %digit

{Digit: any digit from 0 to 9. %0 has the value of batch command as it appears on the command line the batch is executed. %1 represents the first string after the batch commmand. Each occurrence of % replaced by the corresponding string from the batc command line.}

examples

MYBATCH DOC A: COPY *.%1 %2

{Copies all .DOC files in the default directory to d A:}

%VARIABLE% Replaces the DOS environment variable name with its environment value.
%variable%

{Variable: a string of uppercase characers in the environment associated with a string value. Variab created in the environment by using SET.}

examples

%PATH% echo %PATH% %PROMPT%

{Returns the value of PATH, the current search pa which is executable.}

{Displays the value of PATH, the current search p

{Returns the value of PROMPT, the current prom

string, which is executable.} echo %PROMPT% echo The current search path is: %PATH% set USER=John if %USER%= =John goto LABEL

{Displays the value of PROMPT, the current prom string.}

{Displays the message including the current searc path.}

{Since the value of USER does equal "John", the c is transferred to the label, LABEL.}

CALL

Loads and executes a batch file from within a batch file as if it were a external comma When a second batch file completes, control is returned to the calling file. call [drive:][path]filename [batch-parameters] Before DOS version 3.3: command /c [drive:][path]filename [batch-parameters]

CLS

Clears the video display screen, setting the cursor in the upper left-hand corner. cls

ECHO
examples

Controls whether commands and comments within a batch file are displayed. echo [ON|OFF|message|.] echo echo ON echo OFF echo Processing... echo %USER% echo. echo ^L > prn echo Y|Del *.* {Displays echo status} {Restores normal display activity.} {Halts display of DOS prompt and commands.} {Displays "Processing..." on the screen.} {Displays the value of USER on the screen.} {Displays a single blank line on the screen.}

{Sends an ASCII control-code (form feed) to the p Press <Ctrl> plus <L> to type the ^L character.} {Answers the DEL "Are you sure" question automatically.}

Potrebbero piacerti anche