More detailed hands-on teaching you to write batch processing (Willsort version) 1th/5 page _dos/bat

Source: Internet
Author: User
Another, the proposal climbing elder brother to take the article not to rigidly adhere to in the domestic, such technical article, inside and outside the level difference is great; rather than amend the domestic words, better translation of foreign excellent writings.
--------------------------------------------------------
Title: Hands-on teaching you to write batch processing-Introduction to batch processing
Author: anon
Editor: Climbing

Caption: Willsort
Date: 2004-09-21
--------------------------------------------------------
Introduction to Batch Processing


A file with the extension name bat (or cmd under nt/2000/xp/2003) is a batch file.

= = = Willsort Note =====================================================
. BAT is a DOS batch file
. cmd is another batch file for NT Kernel command line environments
In a more general sense, Unix shell scripts and other operating systems and even the text that is interpreted by the shell in the application have a very similar effect to the batch file, and the same is done by the dedicated interpreter in the behavior unit, which is more commonly called the scripting language. So from a degree of analysis, batch, Unix shell, awk, Basic, Perl and other scripting languages are the same, but the scope of application and interpretation of the platform are different. Even some applications still use the term batch, and their content and extension are completely different from the DOS batch.
========================================================================

The first batch file is a text file, and each line of the file is a DOS command (most of the time, like the command line we execute at the DOS prompt), you can use the DOS edit or Windows Notepad (Notepad) Any text file Editing tool creates and modifies a batch file.

= = = = = Willsort Caption ====================================
Non-DOS commands can be used in batch files, and even ordinary data files with no executable feature can be used, which is due to the involvement of the new interpretation platform of Windows system, which makes the application of batch processing more and more "marginalized". So the batch process we're talking about should be limited to DOS or command-line environments, otherwise a lot of ideas and settings need to be changed quite a bit.
========================================================================

Second, batch files are simple programs that control the flow of commands by conditional statements (if) and Process Control statements (goto), and loop statements (for) can be used to loop through a command in batch processing. Of course, the programming ability of batch files and C language programming statements is very limited, but also very nonstandard. The batch process statement is a DOS command (including internal commands and external commands), and the ability to batch processing depends largely on the commands you use.

= = = Willsort Note =====================================================
Batch files (batch file) can also be called Batch programs (batch program), which is different from the compiled language, in the case of C, files with extensions C or CPP can be called C language files or C language source code. But only after compiling the attached EXE file can be called C language program. Because the batch file itself has both the readability of the text and the enforceability of the program, the boundaries of these titles are rather vague.
========================================================================

Third, each prepared batch file is equivalent to a DOS command, and you can place it in your DOS search path (path) so that it can run anywhere. A good habit is to create a bat or BATCH directory on your hard disk (for example, C:\BATCH) and then put all the batch files you write into that directory so that you can run all of your batch programs in any location if you set up C:\batch on the path.

= = = Willsort Note =====================================================
For purely DOS systems, executable programs can be subdivided into five categories, sorted by execution priority from high to Low: Doskey macros (pre-resident memory), command. Internal commands in COM (in memory at any time according to the memory environment), the executable program with COM as the extension (loaded by Command.com directly into memory), executable program with EXE-bit extension (loaded in memory by the Command.com after relocation), Batch program with a bat bit extension (interpreted by Command.com, which invokes the first 2,3,4,5 executable program in order of its content, parsing a row, executing a row, and the file itself is not loaded in memory)
========================================================================

Four, under DOS and win9x/me systems, C: The Autoexec.bat batch file in the packing directory is the automatic running batch file. This file is automatically run every time the system starts, and you can put commands that you want to run every time the system starts up, such as setting the search path, driving the mouse and disk caching, setting the system environment variables, and so on. The following is an example of a Autoexec.bat running under Windows 98:
@ECHO off
PATH C:\WINDOWS; C:\WINDOWS\COMMAND; C:\UCDOS; C:\DOSTools; C:\SYSTOOLS; C:\WINTOOLS; C:\BATCH
LH smartdrv. exe/x
LH Doskey.com/insert
LH Ctmouse. Exe
SET temp=d:\temp
SET tmp=d:\temp

= = = Willsort Note =====================================================
AUTOEXEC. BAT is an automatic running batch file for DOS system, which is interpreted and executed by Command.com when it starts;
And in the Win9x environment, not only increased support for Dosstart. BAT, Winstart. BAT and many other automatically run batch files, the Autoexec.bat also increased. Dos. W40. Bak. Old. PWS and many other variants to adapt to complex environments and changing needs.
========================================================================
Current 1/5 page 12345 Next read the full text

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.