Echo, @, call, pause, and rem are the most common commands for batch file processing. We started from them. Echo indicates the characters after this command
Echo off indicates that after this statement, all running commands do not display the command line itself.
@ Is similar to echo off, but it is added at the top of other command lines, indicating that the command line itself is not displayed during running.
Call calls another batch file (if another batch file is called directly, subsequent commands of the current file cannot be executed after that file is executed)
Running pause will be paused, and Press any key to continue...
Rem indicates that the character after this command is interpreted as a line. If it is not executed, it will only be used for future search.
For example, use edit to edit. bat file, enter the following content and save the disk as c: \. bat, after executing the batch processing file, you can: write all the files in the root directory into a.txt, start UCDOS, enter WPS and other functions.
The content of the batch file is: file representation:
Echo off command line not displayed
Dir c: \ *. *> a.txt: Write the c-drive file into a.txt.
Call c: \ ucdos. bat call ucdos
Echo Hello show "hello"
Pause and wait for the button to continue
Rem uses wps annotation to use wps
Cd ucdos enters the ucdos directory
Wps use wps
You can also use parameters in a batch file like the C language, which requires only one parameter identifier %.
% Indicates a parameter. A parameter is a string added after the file name when a batch file is run. Variables can be represented from % 0 to % 9, % 0 indicates the file name itself, and strings are represented in the order of % 1 to % 9.
For example, C: the name of the processing file in the root directory is f. bat, and the content is format % 1.
If C: \> f a: is executed, format:
Another example is C: The name t. bat of the batch of files processed in the root directory, and the content is type % 1 type % 2.
Run C: \> t a.txt B .txt to display the contents of a.txt and B .txt in sequence.