The extension is a file that BAT (or CMD in NT / 2000 / XP / 2003) is a batch file.
==== willsort Editor's Note =======================================. Bat is dos Batch files under. CMD are another batch file of the NT core command line environment. From a more broad perspective, UNIX's shell script and other operating systems are explained by the case in the application. It is very similar to the batch file, and it is also interpreted by a dedicated interpreter in a behavior unit. This text form is more common to the title is a scripting language. So from some degree analysis, BASIC, UNIX Shell, awk, Basic, The script language such as Perl is the same, but the scope and interpretation of the application are different. Even some applications still use the batch of this styles, and their content and extension and DOS batches are completely different. . ===================================
First batch file is a text file, each line of this file is a DOS command (most of us seem to be the same as the command line executed by the DOS prompt), you can use the Edit or Windows of Windows under DOS. Any text file editing tool such as this (NOTEPAD) creates and modifies the batch file.
==== Willsort inscription =================== Batch file can be used in the batch file, and can even use ordinary data files that do not have executable feature. This is involved in the new interpretation platform of the Windows system, making the application of batch processing more and more "marginalized". So the batch we discussed should be limited to the DOS environment or the command line environment, otherwise many concepts and settings Need to do a relatively large change. =========================================================================================================================================================
Second, the batch file is a simple program that can control the process running through the Conditional Statement (IF) and Process Control Statement (GOTO), and can also use the loop statement (for) to perform a command in the batch. Of course, the programming ability of the batch file is very limited, and it is very unregulated. The program statement of the batch is a DOS command (including internal commands and external commands), and batch The ability to process is mainly dependent on the command you use.
==== Willsort Note ================== Batch file can also be called Batch Program, this point and compilation The language is different. For the C language, the file that extensions C or CPP can be called C language file or C language source code, but only after compiling the EXE file can be called C language program. Because The batch file itself has both the readability of the text, and the programs have the executability of the program. These title boundaries are relatively blurred. ===================== ====== Third, each prepared batch file is equivalent to a DOS external command, you can put it in your DOS search path (PATH) to make it can be arbitrary The location is running. A good habit is to create a BAT or BATCH directory on the hard disk (for example, C: / Batch), then put all your written batch files in this directory, so as long as it is set on the PATH C: / Batch, you can run all your written batch programs in any location.
==== Willsort Note ===== Purely in the DOS system, the executable program can be subdivided into five categories, depending on the execution priority is: Doskey Macro command (pre-resident memory) in accordance with the execution priority ), Internal commands in Command.com (according to the memory environment is stationed at any time), using COM-extension-named executables (directly loaded directly into the intermand.com), the executable of the Exe bit extension (by COMMAND.COM replacement After loading memory), interpretation of BAT extension (interpreted by Command.com), based on its content, according to its content, according to priority order, the executable program, analysis One line, executing a line, the file itself does not load memory) ============
Fourth, under the DOS and WIN9X / ME system, the autoexec.bat batch file under the root directory is automatically run batch file. You can run the file each time the system is started, you can start the system each time The command to run is placed in this file, such as setting the search path, tune the mouse driver and disk cache, set system environment variables. Sample below is an example of AutoeExec.bat running under Windows 98: @echo off path C : / Windows; c: / windows / command; c: / ucdos; c: / dostools;
C: / systools; c: / wintdrv.exe / xlh smartdrv.exe / xlh doskey.com / insertlh ctmouse. Exeset Temp = D: / TEMPSET TMP = D: / TEMP ==== Willsort Note ===== AutoExec.bat is the automatic run batch file of the DOS system, interpret it by command.com, and in Win9X In the environment, not only, not only many other automatic batch files such as dosstart.bat, WinStart.bat are supported, but also adds Many variants such as .dos .w40 .bak .old .pws to adapt to complex environments. And multiple demand. ==== Willsort Note ========================================================================================================================= The commands that are also commonly used in Copy are not included, and all commands in the special command are common commands. It is recommended to divide the commands referenced by the batch into internal commands, external commands, third-party programs. There is a class of internal commands and external commands that are dedicated to or commonly used in batch, which can be called "batch commands". The following excerpts the "Batch Command" in the MS-DOS 6.22 help documentation, of course Some concepts and definitions have been behind.
Batch command
Batch file or batch program is a text file containing several MS-DOS commands, the extension is .bat. When the name is knocked in the approved program, the MS-DOS group executes this batch program. The order.
Any commands that can be used under the command prompt can be used in the batch program. In addition, the following MS-DOS command is specifically used in the batch program. ==========
Common command
Echo, @, call, pause, remote: Use :: Replace REM) is the most commonly used commands of the batch file, and we start learning from them.
==== Willsort Note =========== First, @ is not a command, but a special tag for DOS batch, only for shielding command lines. Below is the DOS command line Or some special tags that may be seen in batches: Cr (0D) command line end values escape (1b) ANSI escape character guidance Space (20) Common parameter definition Tab (09); = Utty parameter Default COPY Command File Connector *? File Wildcarcy "" Character Series Calculation | Command Vehicles <> >> File Redirector @ Command Row Send Shield / Parameter Switch Guide: Batch Tag Guide% Batch Treatment variable guidance
Second, :: I really can play the Note effect of REM, but more concise; but there is two points to pay attention: First, except: In addition to ::, anything in the beginning, is considered in batches Number, but directly ignore all of its subsequent content, just to distinguish between normal labels, it is recommended to use the labels that GOTO unrecognizable, ie, tighten a special symbol of a non-alphanumeric. Second, different from REM Yes, :: After the character is executed, it will not be returned when executed, whether or not, open the command line echo status, because the command interpreter does not think he is a valid command line, in this point, REM is The ratio is more applicable under certain occasions; in addition, REM can be used in config.sys files. ============================ icho indicates that this command is displayed The post-character echo off indicates that all run commands after this statement do not display the command line itself @ and the echo offline, but it is the most in front of each command line, indicating that the command line does not show this line when running (You can only affect the current line) .Call call another batch file (if you do not use Call to directly call other batch files, then after the batch file will not return to the current file and perform the subsequent command of the current file). PAUSE runs this sentence to suspend the execution of the approve and display the prompts of the press any key to contact ... on the screen, wait for the user to continue REM to continue REM to indicate the character after this command is explained (notes), not executed, just Give yourself refer to the reference (equivalent to the comment in the program). ==== Willsort Note ===== Description This is more confusing, it is better to directly reference the command line of the command to help more escort
------------------------- Echo
When the program is run, the text in the batch program is displayed or hidden. It can also be used to allow or disable command echo.
When running a batch program, MS-DOS is typically displayed on the screen (erase) batch program in the screen. Use the echo command to turn this feature.
grammar
Echo [on | OFF]
To display a command with the echo command, you can use the following syntax:
Echo [Message]
parameter
ON | OFF Specifies whether the command is allowed to return to the command. To display the current Echo settings, you can use the Echo command without parameters.
Message Specifies the body that allows MS-DOS to display on the screen.
-------------------
Call
Call another batch program from a batch program without causing the initiation of the first batch.
grammar
Call [Drive:] [PATH] FileName [Batch-parameters]
parameter
[Drive:] [PATH] FILENAME Specifies the name and storage of the batch program to be called. The file name must be used to extension with .bat.
Batch-parameters specifies the command line information required for batch program.
-------------------------------
PAUSE
The execution of the batch program and displays a message, prompting the user to press any key to continue execution. You can only use this command in the batch program.
grammar
PAUSE
REM
Add annotations to batch files or config.sys. You can also use the REM command to block commands (you can use a semicolon (;) in config.sys instead of the REM command, but cannot be replaced in the batch file).
grammar
REM [String]
parameter
String Specifies the command to be masked or the annotations to be included. ========================
Example 1: Edit a.bat file with Edit, enter the following contents After the store is c: /a.bat, you can implement it after executing the batch file: write all the files in the root directory to A.TXT, start UCDOS, enter WPS and other functions. The content of the batch file is: Command Note:
@echo off does not display the subsequent command line and the current command line DIR C: /*.*> a.txt Write the C-disk file list to a.txt call c: /ucdos/ucdos.bat call ucdos echo Hello, you show "You Good "pause pause, wait button to continue REM ready to run WPS Note: Prepare to run WPS CD UCDOS to enter UCDOS directory WPS run WPS
Batch file parameters
Batch files can also use parameters like the C language function (equivalent to the command line parameters of the DOS command), which requires a parameter representator "%".
% [1-9] indicates parameters, refers to a string separated by a space (or Tab) after the file name is running, and the variable can be batch commands from% 0 to% 9,% 0. It itself, other parameter strings are represented by% 1 to% 9.
Example 2: C: There is a batch of processing files named f.bat in the root directory: @echo offformat% 1
If C: /> f A: So when F.BAT is executed, the% 1 represents A:, so FORMAT% 1 is equivalent to Format A:, then the above command is actually executed, format A:
Example 3: C: The next batch of processing files in the root directory is T.BAT, the content is: @echo offty% 1TYPE% 2
Then run C: /> T a.txt b.txt% 1: Represents A.TXT% 2: Indicates that B.TXT The above command will sequentially display the contents of the A.TXT and B.TXT files.
==== Willsort Note =============== Parameter is also treated as a variable in batch processing, so use the percent sign as the guide, followed by one of 0-9 Digital constitutes a parameter reference. The relationship between the references and parameters (such as% 1 and A:) is similar to the relationship between the variable pointer and the variable value. When we want to reference the eleventh or more parameters, It is necessary to move the DOS parameter start pointer. The Shift command is acting as the role of this mobile pointer, which moves the starting pointer of the parameter to the next parameter, similar to the pointer operation in the C language. Figure:
Initial state, cmd is a command name, you can use% 0 CMD arg1 arg2 arg3 arg4 arg5 arg6 arg7 arg8 arg9 arg10 ^ ^ ^ ^ ^ ^ ^ ^ | | | |% 0% 1% 2 % 3% 4% 5% 6% 7% 8% 9
After 1 SHIFT, CMD will not be referenced to cmd arg1 arg2 arg3 arg4 arg5 arg6 arg7 arg8 arg9 arg10 ^ ^ ^ ^ ^ ^ ^ ^ ^ | | | | | |% 0% 1% 2% 3 % 4% 5% 6% 7% 8% 9
After 2 SHIFT, Arg1 was also discarded,% 9 points to empty, no reference significance cmd arg1 arg2 arg3 arg4 arg5 arg6 arg7 arg8 arg9 arg10 ^ ^ ^ ^ ^ ^ ^ | | | | | | | | 0% 1% 2% 3% 4% 5% 6% 7% 8
Unfortunately, Win9X and DOS do not support Shift's inverse operation. Only in the NT core command line environment, Shift supports / n parameters, and can return to the mobile start pointer with the first parameter. ==== ================ Special command
If Goto Choice for is a relatively advanced command in a batch file. If you are very skilled, you are an expert in batch files.
First, if the IF is a conditional statement, it is used to determine whether it meets the specified conditions, thereby deciding to perform different commands. There are three formats:
1, if [not] "parameter" == "string" command to be executed
If the parameter is equal to (NOT means not et al, the following) The specified string, the condition is established, run the command, otherwise run the next sentence.
Example: if "% 1" == "a" format A:
==== Willsort Note
The description of the IF command line About this is: if [not] string1 == String2 Command There is something you need to pay attention to: 1. Double quotes containing the string are not necessary, but just use it. A "air defense" character 2. String1 is not necessarily parameters, which can also be environment variables, cyclic variables, and other string constants or variables 3. Command is not a syntax, String2 follows a space to form a valid command. Row =============================
2, if [not] exist [path /] file name to be executed, if there is a specified file, the condition is established, run the command, otherwise run the next sentence.
Such as: if exist c: /config.sys type c: /config.sys Indicates that it is displayed if there is a C: /Config.sys file.
****** WILLSORT Note ************* can also use the following usage: if exist command refers to the device that has been loaded in the DOS system, usually: AUX, PRN, CON, NULCOM1 , COM2, COM3, COM4LPT1, LPT2, LPT3, LPT4XMSXXXX0, EMMXXXX0A: B: C: ..., Clock $, Config $, DBLBUFF $, IFS $ HLP $ Specific content is slightly different due to hard software environment When using these device names, the following three points are required: 1. The device does exist (except for software virtual devices) 2. The device driver has loaded (AUX, PRN and other standard devices are defined by the system default) 3. The device is ready (mainly referring to A: B: ..., COM1 ..., LPT1 ..., etc.) can review your system by command MEM / D | FIND "Device" / i to review your system. Equipment In addition, in the DOS system, the device is also considered a special file, and the file can also be referred to as a character device; because the device is managed using the handle (Handle), the handle is the name, Similar to the file name, but the handle is not applied to disk management, but is applied to memory management. The so-called device loading is also a handle that assigns a referenced in memory. =========== =====================================================================================================================================================
3, if Errorlevel
If Errorlevel 2 Goto X2
==== Willsort Note =========== The return value is not necessary from the large to small order, but only the habitual usage when the command is goto, when using SET as an execution command, It is usually arranged in a small order, for example, if you need to put the return code into the environment variable, you need to use the following order:
IF Errorlevel 1 set el = 1if Errorlevel 2 set el = 2IF Errorlevel 3 set el = 3if Errorlevel 4 set el = 4if Errorlevel 5 set el = 5 ...
Of course, you can also use the following loop to replace, principle is consistent: for %% E in (1 2 3 4 5 6 7 8 ...) DO if ErrorLevel %% E set el = %% E
More efficient and simple usage, you can refer to another article on get Errorlevel
The reason for this phenomenon is that if errorlevel compares the judgment condition of the return code is not equal, but is greater than or equal. Sorts the jump characteristics of GTO, it can be jumped out of the smaller return code; "Repeat" assignment characteristics of the set command, which will cause a smaller return code "override" larger return code.
In addition, although if ErrorLevel =
Second, the GOTO batch file is running here will jump to the reference numeral specified by Goto (label, label is defined by: Command group.
Such as:
Goto end
: Endecho this is the end
The label is defined with the ": string", and the routing is not executed.
==== Willsort Note
Label is often translated into "label", but this does not have extensive convention.
GOTO and: Jump can be implemented in the middle of the way, and then combined with the IF to implement the conditional branch of the execution process, multiple IF can implement the command group, similar to the Switch Case structure or the SELECT CASE structure in the Basic, large scale And the structured command group enables function functions in advanced languages. The following is a comparison of batch and C / Basic in syntax structure:
Batch C / BasicGoto &: Goto &: Goto & Else {} / IF & Elseif & Else {} / if & elseif & Endifoto & IF ... Switch & Case / Select Casegoto & IF & Set & Envar ... function () / function (), SUB () ======= ===========================3, Choice Use this command to allow users to enter a character (for choice), thus according to user selection Returns different ErrorLevel, then works different commands based on the user's selection.
Note: The choice command is the external command provided by the DOS or Windows system. Different versions of the Choice command speech will be slightly different. Please use the khoice /? View.
Choice's command syntax (this syntax is the syntax of the choice command in Windows 2003, and the other version of the Choice command syntax is similar to this.):
Choice [/ cchoices] [/ n] [/ cs] [/ t timeout / d choice] [/ m text]
Description: This tool allows users to select an item from the selection list and return the index of the selected item.
Parameter list: / c Choices Specifies the list of options to create. The default list is "YN".
/ N hides the list of options in the prompt. Prompt the previous message get displayed, the option is still enabled.
/ Cs allows selection options. By default, this tool is not case-sensitive.
/ T timeout, the number of seconds paused before the default selection. Acceptable values are from 0 to 9999. If 0 is specified, there will be no pause, the default option will be selected.
/ D Choice specifies the default option after nnnn seconds. The character must be in a set of selections specified by / c option; at the same time, NNNN must be specified with / t.
/ M text Specifies the message to display before prompt. If you do not specify, the tool only shows the prompt.
/? Display help messages.
Note: The ErrorLevel environment variable is set to the key index selected from the selection set. The first selection lists returns 1, the second selection returns 2, and so on. If the user presses the key is not a valid choice, the tool will be issued WARNING. If the tool detects the error status, it will return 255 ErrorLevel values. If the user presses Ctrl Break or Ctrl C key, the tool returns 0 ErrorLevel value. When using the Errorlevel parameter in a batch, Align the parameters.
Example: choice /? Choice / c ync / m "Confirm, please press Y, please press N, or cancel, press C." Choice / T 10 / C YNC / CS / D YCHOICE / C AB / M "option 1 Select A, Option 2 Please select B. "Choice / C Ab / N / M" option 1 Select a, option 2 Please select B. "
==== Willsort Note =============================== I lists the use of choice under Win98. distinguish
Waits for the user to cho cho should one of a set of choices. Waiting for users to choose a group of choice [/ c [:] choices] [/ n] [/ s] [/ t [:] C, NN ] [Text]
/ C [:] Choices Specifies Allowable Keys. Default is Yn Specifies the allowed button (to be selected by the characters), the default is YN / N DO NOT DISPLAY Choices and? At End of Prompt String. Do not display the question mark in the prompt string and stay Selecting characters / s Treat Choice Keys as Case Sensitive. Sensitive Sensitive / t [:] C, Nn Default Choice to C after Nn Seconds Default Select CText Prompt String to Display to display prompt characters String ErrorLevel Is Set To Offset Of Key User Presses in Choices.ErrorLevel is set to the user typed by the user in the ============================================================================================================================================================ ================
If I run the command: choice / c ync / m "Confirm, press Y, please press N, or cancel, press the C." screen: Confirm, press Y, please press N, or cancel, press C. [Y, n, c]?
Example: Test.bat is as follows (note that when the return value is used to determine the return value with if ErrorLevel, press the return value from high to low alignment): @ echo offchoice / c DME / M "defrag, mem, end" if Errorlevel 3 Goto Endif Errorlevel 2 Goto Memif Errorlevel 1 Goto Defrag
: defragc: / dos / defraggoco End
: MemmemgoTo End
: Endecho Good Bye
After this batch run, "DEFRAG, MEM, END [D, E]?", The user can select DME, then the IF statement determines based on the user's selection, D represents the block, M, M, M, M, M Indicates a block that executes the label MEM, and e means executing the program of the label End, and each block is finally jumped to the END Number with goto End, and then the program will display good Bye, the batch run.
Fourth, for loop command, as long as the condition is in line with, it will execute the same command multiple times.
Syntax: Perform a particular command to each file in a set of files.
For %% Variable In (SET) Do Command [Command-Parameters]
%% variable specifies a single letter replaceable parameter. (SET) Specify one or a set of files. You can use wildcard .command specify that commands per file execute. CommanD-parameters assign a parameter or command line switch for a specific command.
For example, there is a line in a batch file: for %% c in (* .bat * .txt) Do Type %% C
The command line displays all the contents of the files with BAT and TXT-based files in the current directory.
==== WILLSORT bet ============================================== ========== Need to indicate that when the string in () is not single or multiple file names, it will be simply replaced by a string, and this characteristic plus () can Embed a number of strings, it is obvious that FOR can be seen as a traversal cycle. Of course, in the NT / 2000 / XP / 2003 series of command line environments, for more features, make it possible Analyze command output or strings in the file, there are many switches to extend file replacement. ============================ ==================================================== Batch example
IF-EXIST
1) First use Notepad in C: / create a TEST1.BAT batch file, the file content is as follows: @echo offif exist /autoexec.bat type /autoexec.batif not exist /autoexec.bat echo /autoexec.bat does not exist
Then run it: C: /> Test1.bat
If C: / exists autoeexec.bat file, then its content will be displayed, if there is no existence, the batch will prompt you if the file does not exist.
2) Then then build a Test2.bat file, the content is as follows: @echo offif exist /% 1 TYPE /% 1IF NOT /% 1 ECHO /% 1 Does not exist
Execute: c: /> Test2 autoexec.bat This command runs the result.
Description: (1) if exist is used to test whether the file is existing, the format is the% 1 of the IF exist [Path File Name] command (2) Test2.bat file is the parameter, the DOS allows 9 batches of parameter information Batch file,% 1 ~% 9 (% 0 indicate the Test2 command itself), this is a bit of the relationship between the arguments and metall parameters in the programming, and% 1 is the ginseng, autoexec.bat is the argument.
==== WILLSORT bet ============================================== ========== DOS does not "allow 9 batch parameter information" limit, the number of parameters will only be limited by the command line length and the call processing capability. However, we are batching programs In the same time, 10 parameters can only be referenced at the same time, because DOS only gives% 0 to% 9 ten parameter references. =================== ============================================================================================================================================================================================================= === 3) Further, create a file called Test3.bat, the content is as follows: @echo offif "% 1" == "a" echo xiaoif "% 2" == "b" echo tianif "% 3 "==" c "echo xin
If you run: c: /> Test3 a b c screen is displayed: xiaotianxin
If you run: c: /> Test3 a b screen will display xiaotian
During this command execution, DOS specifies an empty string to the parameter% 3.
2, if-errorlevel
Establish Test4.bat, the content is as follows: @echo offxcopy c: /autoexec.bat D: / if errorlevel 1 echo file copy failed if errorlevel 0 Echo success copy file
Then execute the file: c: /> TEST4
If the file copy is successful, the screen will display "Successful Copy File", otherwise "file copy failed" will be displayed.
If ErrorLevel is used to test the return value of its previous DOS command, pay attention is just the return value of the last command, and the return value must be determined from large to small order. Therefore, the following batch file is wrong:
@Echo offxcopy c: /autoexec.bat D: / if ErrorLevel 0 Echo success copy file if Errorlevel 1 Echo Did not find copy file If Errorlevel 2 Echo user via CTRL-C suspension Copy Operation IF Errorlevel 3 ECHO Preset Error Block File Copy Operation IF Errorlevel 4 Echo copy process during writing
Whether the copy is successful, followed by:
Did not find a copy file user via the Ctrl-C suspension copy operation preset error Block file copy operation copy process during writing
Will be displayed.
The following is the return value of several common commands and their representatives:
Backup0 Backup Success 1 Didsend Backup File 2 File Shared Conflict Block Backup Complete 3 Users Stopping Backup 4 Due to fatal errors Make backup operations Aborted DISKCOMP0 disk compared to 1 disk comparison 2 users Through CTRL-C Due to fatal errors, comparison operations abort 4 preset errors
DiskCopy0 disk copy operation success 1 Nelfally read / write error 2 users End copy operation 3 due to fatal processing errors to copy the disk 4 preset error Block copy operation
Format0 Format Success 3 Users Surstart Formatting by Ctrl-C Stopping 4 Because of the fatal processing error makes the formatting abort 5 at prompt "Proceed WITH FORMAT (Y / N)?" User Type N End
XCOPY0 Success Copy File 1 Didsence Copy File 2 User Via Ctrl-C Abort Copy Operation 4 Preset Error Block File Copy Operation 5 Copy Process During Write Diagram
==== WILLSORT bet ============================================== ========== CHKDSK0 Didn't find an error 255 Find one or more errors
Choice0 users Press CTRL C / BREAK1 Users Press the first key 255 to detect the error criteria in the command line, other users pressed in the list
DEFRAG0 Debris Compression Success 1 The internal error 2 There is no empty cluster on the disk. To run DEFRAG, at least one empty cluster 3 users exit DEFRAG4 DEFRAG4 A general error 5 Defrag encountered errors 6 Defrag when reading In the cluster, the error is encountered 7 allocation space has a wrong 8 memory error 9 does not have enough space to compress disk fragments
DELTREE0 successfully deleted a directory
DiskComp0 two discs identified different 2 Press Ctrl C to terminate comparison 3 Severe error 4 appears initialization error
Find0 looks successfully and at least finds a matching string 1 Find success but did not find a matching string 2 lookup error
Keyb0 keyboard definition file load success 1 Using illegal keyboard code, character set or syntax 2 keyboard definition file or no 4 keyboard, the monitor 5 When the monitor is not ready, the character set is not ready
MOVE0 successfully moved the specified file 1 error
MSAV / N86 checks the virus
Replace0 Replace Successfully replaces or adds a file 1 MS-DOS version and Replace Not compatible 2 Replace Can not find the source file 3 Replace Can not access the source path or target path 5 If you want to replace the file 8 memory is not possible to execute the replace11 command Phaseoquence error
Restore0 Restore successfully recovered file 1 Restore could not find a file to be recovered 3 Use Ctrl C termination recovery process 4 Restore terminates due to errors
ScanDisk0 Scandisk did not detect any error on the drive it checked 1 Due to the syntax of the command line, it was not possible to run scanDisk2 due to memory exhaustion or internal error, and ScanDisk accidentally terminated 3 users to exit 4 of ScanDisk exit 4 for disk scanning, users decided Exit 254 ScanDisk in advance to find disk failure and all correct 255 scandisk find disk failure, but failed to correct
SETVER0 SETVER successfully completed the task 1 user specified an invalid command switch 2 user specified an illegal file name 3 Not enough system memory to run the command 4 users specified an illegal version number 5 setVer in the version table No specified item 6 SETVER NOW SETVER.EXE file 7 User specified an illegal driver 8 user specified too much command line parameter 9 setVer detected that the command line parameter 10 was read in the setver.exe file, setver detection To the error 11 setver.exe file corruption 12 specified SETVER.EXE file does not support version Table 13 Nothing space stored in the table 14 Nothing to store new item 14 When writing setver.exe files, SETVER detects an error ===== ============================================================================================================================================================================================================= ================= 3, if string1 == String2
Establishing TEST5.BAT, the file content is as follows: @echo offif "% 1" == "a" format A:
Perform: C: /> Test5 A screen appears to form a: disk formatted content.
Note: In order to prevent parameters from being empty, the string is generally enclosed in double quotes (or other symbols, pay attention to the reserved symbol). Such as: if [% 1] == [a] or if% 1 * = = A *
5, goto
Establishing TEST6.BAT, the contents of the file are as follows: @echo offif exist c: /autoexec.bat goto _copygoto _done: _copycopy c: / /autoexec.bat D: /: _ DONE
Note: (1) Before the label is the column of the ASCII characters ":": "There is no space between the colon and the label. (2) Name rules of the label are the same as the name rules of the file name. (3) DOS supports the longest eight characters The label, when the two labels cannot distinguish, will jump to the nearest label.
==== WILLSORT bet ============================================== =========== 1) The label is also called the label 2) The label cannot start with most non-alphabetic characters, and a lot of file names can be used 3) When the two labels cannot be distinguished When the jump to the last tag ======================================= ================================== 6, for
Established C: / Test7.bat, the file content is as follows: @echo offfor %% C in (* .bat * .txt * .sys) do type %% C
Run: c: /> TEST7
After execution, all the C: Panhe TXT, SYS is displayed in BAT, TXT, and SYS (excluding the hidden file).