More detailed hands-on teaching you to write batch processing (willsort version) page 1 / 5


In addition, it is suggested that brother climbing should not rigidly adhere to the domestic literature, for this kind of technical articles, there is a great difference between the domestic and foreign level; instead of correcting a few words in China, it is better to translate excellent foreign works.
Title: hand in hand teach you to write batch – batch introduction
Author: Anonymous
Editor: climbing

Caption: will sort
Date: September 21, 2004
Introduction of batch processing

A file with bat extension (or CMD under NT / 2000 / XP / 2003) is a batch file.

====Notes on willsort=====================================================
. bat is a batch file under DOS
. CMD is another batch file in NT kernel command line environment
In a broader sense, UNIX shell scripts and texts interpreted and executed by the shell in other operating systems and even applications all have the same functions as batch files, and are also interpreted and executed by special interpreters as behavioral units. This form of text is more commonly called scripting language. So to some extent, batch, UNIX, shell, awk, basic, Perl and other scripting languages are the same, but the application scope and interpretation platform are different. Even some applications still use the term batch processing, but its content and extension are completely different from DOS batch processing.

First of all, a batch file is a text file. Each line of the file is a DOS command (most of the time, it’s just like the command line that we execute at the DOS prompt). You can create and modify the batch file by using any text file editing tool such as DOS edit or windows Notepad.

====Will sort====================================
Non DOS commands can be used in batch files, and even ordinary data files without executable characteristics can be used. This is due to the involvement of windows system, a new interpretation platform, which makes the application of batch processing more and more “marginalized”. Therefore, the batch processing we discussed should be limited to DOS environment or command line environment, otherwise many concepts and settings need to be changed greatly.

Secondly, batch file is a simple program, which can control the process of command running through condition statement (if) and process control statement (goto). In batch processing, it can also use loop statement (for) to execute a command circularly. Of course, the programming ability of batch file is very limited and nonstandard compared with C language. Batch processing program statements are DOS commands (including internal and external commands), and the ability of batch processing mainly depends on the commands you use.

====Notes on willsort=====================================================
Batch file can also be called batch program, which is different from compiled language. For C language, the file with extension C or CPP can be called C language file or C language source code, but only the compiled and connected EXE file can be called C language program. Because the batch file itself has the readability of text and the executable of program, the boundary of these terms is relatively vague.

Third, each batch file is equivalent to a DOS external command. You can put its directory in your DOS search path to make it run anywhere. A good habit is to set up a bat or batch directory on the hard disk (for example, C:: batch), and then put all the batch files you write in that directory. So as long as you set C:: batch in the path, you can run all the batch programs you write anywhere.

====Notes on willsort=====================================================
In the case of DOS system, the executable programs can be divided into five categories: doskey macro command (pre resident memory), DOS key macro command (pre resident memory), DOS key macro command (pre resident memory), DOS key macro command (pre resident memory), COMMAND.COM According to the environment of memory, the internal command of com (enter the memory at any time) and the executable program with the extension of com (run by Directly loaded into memory, to exe bit extension of the executable program (by the Relocates and loads it into memory, a batch program with bat bit extension (by Explain and analyze, call the second, third, fourth and fifth executable programs in priority order according to their contents, analyze one line, execute one line, and the file itself is not loaded into memory.)

Fourth, in dos and Win9x / me system, C: under the packing directory AUTOEXEC.BAT Batch file is a batch file that runs automatically. It will run automatically every time the system starts. You can put the commands that need to run every time the system starts into the file, such as setting the search path, calling the mouse drive and disk cache, setting the system environment variables, etc. The following is a program running under Windows 98 autoexec.bat An example of

====Notes on willsort=====================================================
AUTOEXEC.BAT For DOS system automatic run batch file, by the COMMAND.COM Interpretation and execution at startup;
In Win9x environment, not only support is added DOSSTART.BAT , WINSTART.BAT And many other automatically run batch files AUTOEXEC.BAT Also added. DOS. W40. Bak. Old. PWS and many other variants to adapt to the complex environment and changing needs.

12345 read the full text on the next page