way, you only need to set c:/batch in the path, and you can run all your batch processing programs at any location.
Fourth, in DOS and Win9x/Me systems, C: AUTOEXEC under the root directory. BAT batch files are automatically run batch files. Each time the system starts, the files are automatically run. You can put the commands to be run every time the system starts, for example, you can set the search path, call the mouse driver and disk cache, and s
your dos search path) so that it can run in any location. A good habit is to create a bat or batch directory (for example, c: \ batch) on the hard disk, and then put all the batch files you have compiled into this directory, in this way, you only need to set C: \ batch in the path, and you can run all your batch processing programs at any location.
Fourth, in DOS and Win9x/me systems, C: autoexec under the root directory. bat batch files are automati
batch processing are several DOS commands (including internal commands and external commands). The batch processing capability depends on the commands you use.Third, each written batch processing file is equivalent to a DOS external command. You can put the directory in your DOS search path) so that it can run in any location. A good habit is to create a bat or batch directory (for example, C: \ BATCH) on the hard disk, and then put all the batch files you have compiled into this directory, in
the directory in your dos search path) so that it can run in any location. A good habit is to create a bat or batch directory (for example, c: \ batch) on the hard disk, and then put all the batch files you have compiled into this directory, in this way, you only need to set C: \ batch in the path, and you can run all your batch processing programs at any location.
Fourth, in DOS and Win9x/me systems, C: autoexec under the root directory. bat batch
the directory in your dos search path) so that it can run in any location. A good habit is to create a bat or batch directory (for example, c: \ batch) on the hard disk, and then put all the batch files you have compiled into this directory, in this way, you only need to set C: \ batch in the path, and you can run all your batch processing programs at any location.
Fourth, in DOS and Win9x/me systems, C: autoexec under the root directory. bat batch f
this way, you only need to set C:/batch in the path, and you can run all your batch processing programs at any location.
Fourth, in DOS and Win9x/me systems, C: autoexec under the root directory. bat batch files are automatically run batch files. Each time the system starts, the files are automatically run. You can put the commands to be run every time the system starts, for example, you can set the search path, call the mouse driver and disk cache,
macro, or "Auto" macro. The automatic macros provided by Word and their operating conditions are as follows:Macro name Run conditionAutoExec When you start WordAutoNew When you create a new documentAutoOpen when you open an existing documentAutoClose when you close a documentAutoExit when you quit Word
Second, create macrosfrom the above 5 automatic macros, we know that the AutoExec macro will run automatically when you start Word, so long as we
each file in a group of files.
For % variable in (SET) do command [command-parameters]
% Variable specifies a single letter replaceable parameter.
(SET) specifies one or more files. Wildcard characters can be used.
Command specifies the Command executed on each file.
Command-Parameters
Specify parameters or command line switches for specific commands.
For example, a batch file contains one row:
For % C in (*. bat *. txt) do type % C
The command line displays the contents of all files with the b
test1.bat batch file in C:/. The content of the file is as follows:@ Echo off if exist/autoexec. batType/autoexec. batIf not exist/autoexec. Bat echo/autoexec. bat does not existThen run it:C:/> test1.batIf the C:/file contains the autoexec. BAT file, its content will be di
, you can put the command that will run every time the system starts, such as setting the search path, adjusting the mouse driver and disk cache, setting the system environment variables, and so on. The following is an example of a Autoexec.bat running under Windows 98:@ECHO OFFPATH C:\WINDOWS; C:\WINDOWS\COMMAND; C:\UCDOS; C:\dostools;C:\SYSTOOLS; C:\WINTOOLS; C:\BATCHLH smartdrv. exe/xLH Doskey.com/insertLH Ctmouse. ExeSET temp=d:\tempSET tmp=d:\temp* = = =====
the command output or strings in the file, many switches are also used to extend the file replacement function.
Batch Processing example
1. If-exist
1) First, use NotePad to create a test1.bat batch file in c: \. The content of the file is as follows:
@ Echo off if exist \ autoexec. bat
Type \ autoexec. bat
If not exist \ autoexec. Bat echo \
several DOS commands (including internal commands and external commands). The batch processing capability depends on the commands you use.
Third, each written batch processing file is equivalent to a DoS external command. You can put the directory in your dos search path) so that it can run in any location. A good habit is to create a bat or batch directory (such as C:/batch) on the hard disk, and then put all the batch files you have written into this directory, in this way, you only need to s
is completed.
4. The for loop command will execute the same command multiple times as long as the conditions are met.
Syntax:
Execute a specific command on each file in a group of files.
For % variable in (SET) do command [command-parameters]
% Variable specifies a single letter replaceable parameter.
(SET) specifies one or more files. Wildcard characters can be used.
Command specifies the Command executed on each file.
Command-Parameters
Specify parameters or command line switches for specific
statement increases from 1 (start) to 5 (end. what is the purpose of this? In fact, I think this thing is still very useful. for the simplest example, we want to repeat the "I am the best" Statement and repeat it 10 times. the for command is as follows: For/L % E in (, 10) Do echo "I am the best, CMD will repeat "I am the best" 10 times.
Batch Processing example
1. If-exist
1)
First, use NotePad to create a test1.bat batch file in C: //. The file content is as follows:@ Echo offIf exist //
Bat Batch File Syntax (2)
Batch Processing example:
1. If-exist
1) First, use NotePad to create a test1.bat batch file in C:/. The content of the file 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 the C:/file c
in the current directory. Batch Processing example1. If-exist1) First, use NotePad to create a test1.bat batch file in C:/. The content of the file is as follows:@ Echo offIf exist/autoexec. bat type/autoexec. batIf not exist/autoexec. Bat echo/autoexec. bat does not existThen run it:C:/> test1.batIf the C:/file conta
: open a file
Set textstream object name = FileSystemObject name. opentextfile (file name, Io mode, whether to automatically create a file)File Name: it is recommended to write the complete path file name.Io mode: it can be set to forreading (= 1), forwrting (= 2), or forappending (= 8 ).If it is set to forreading, The opened file is read-only;If it is set to forwriting, The opened file is writable, and the content of the original file is cleared;If it is set to forappending, The opened file is
particular command.
For example, there is one row in a batch file:
For%%c in (*.bat *.txt) do type%%c
The command line displays the contents of all files with bat and txt extensions under the current directory.
Batch processing sample
1. If-exist
1)
First use Notepad to create a test1.bat batch file in C:\, which reads as follows:
@echo off
IF EXIST \autoexec. BAT TYPE \autoexec. BAT
IF not EXIST \
and txt extensions under the current directory.
Batch processing sample
1. If-exist
1)
First use Notepad to create a test1.bat batch file in C:\, which reads as follows:
@echo off
IF EXIST \autoexec. BAT TYPE \autoexec. BAT
IF not EXIST \autoexec. BAT ECHO \autoexec. BAT does not exist
And then run it:
C:\>test1. BAT
under the current directory.
Batch processing sample
1. If-exist
1)
First use Notepad to create a test1.bat batch file in C:\, which reads as follows:
@echo off
IF EXIST \autoexec. BAT TYPE \autoexec. BAT
IF not EXIST \autoexec. BAT ECHO \autoexec. BAT does not exist
And then run it:
C:\>test1. BAT
If a Autoexec.bat
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.