, each increment is 1. the position of the 5 behind the end indicates the size of the end. this 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 cr
". Each program segment finally jumps the program to the end label with "Goto end", and the program displays "good bye". The batch processing 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
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 set C:/batch in the path, and you can run all your batch proce
used.Command specifies the Command executed on each file.Command-parameters specifies a parameter or command line switch for a specific command.For example, a batch file contains one row:For % C in (*. bat *. txt) do type % CThe command line displays the contents of all files with the bat and TXT extensions in the current directory. Batch Processing example1. If-exist1) First, use NotePad to create a test1
executed for each file.
Command-parameters
Specify a parameter or command-line switch for a specific 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.
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 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
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 bat and TXT extensions in the current directory.
===== Willsort compilation ======================================== ==============================It should be noted that when the string in () is not a single or multiple file names, i
Bat encryption script(Save As A. BAT file)
@ Echo off
Cls
Color 2a
: Start
Cls
Echo *************************************** ****************************************
Echo **
Echo * BAT password final version *
Echo **
Echo *************************************** ****************************************
Echo.
Echo.
The final version of echo
The BAT (batch file) batch is a good thing, the computer Stone age of the weapon, today is still not outdated, the work of accumulating some commonly used batch processing command is still very useful, today to share a practical development used.Scene:You need to start multiple Tomcat services under Windows, and you need the first service to start successfully before you can start a second, third service.Workaround:The first service judge whether to s
BAT (batch file or batch program) File Syntax and skills
First, the batch processing file is a text file. Each line of the text file is a DOS command.
Second, the batch processing file is a simple program. You can use if and goto to control the process and for to execute a command cyclically.
Again: A compiled batch processing file is equivalent to a DoS external command, that is, as long as you store the BAT
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 b
The cloud-dwelling community here is simple to organize the common method, convenient for everyone to use. It's all through VBScript code.
The way to hide the cmd window while running a bat can edit a VBS script in which the batch program runs with a hidden window.
Copy Code code as follows:
Set ws = CreateObject ("Wscript.Shell")
Ws.run "cmd/c Batch program name", Vbhide
Copy the code above to Notepad, save it as "Runbat.vbs
notepad.exetaskkill/s system/u domain\username/fi "username ne nt*"/im *taskkill/s system/u username/p password/fi "imagename eq note*"
taskkill/f/im TEL.exetaskkill/f/im MT.exetaskkill/f/im EastFaxServer.exetaskkill/f/im EastFaxExtPrinter.exetaskkill/f/im EastFaxService.exenet stop MSSQLServer
Automatic shutdownAt 22:00 shutdown-s shutdown every 22:00
At 22:00/every:s shutdown-s off at 6 22:00 per week
At 22:00/every:3 shutdown-s 3rd per month 22:00 scheduled shutdown at 21:30 Shutdown-f-R Re
The teaching of batch processing
(A batch file is made up of one or more DOS commands and executable commands with an extension.) BAT's file. When the user names the batch file as a command, DOS automatically executes the commands in the file sequentially. Batch files are characterized by a single build that can be executed multiple times.
There is a special batch file in the batch file, and every command in the file is automatically executed each time the computer is started. The file must m
location.
===== Note ======In the case of a DOS system, the executable program can be divided into five sub-categories. The execution priorities are: doskey macro commands (pre-resident memory), command. internal commands in COM (in memory at any time according to the memory environment), executable programs with the COM Extension (directly loaded into memory by command.com ), executable programs with exe extensions (loaded into memory after command.com is relocated), and batch processing progr
following batch file is therefore incorrect:
@ECHO off
XCOPY C:\AUTOEXEC. BAT D:\
IF ERRORLEVEL 0 ECHO successfully copies files
IF ERRORLEVEL 1 ECHO does not find the copy file
IF ERRORLEVEL 2 ECHO user aborts copy operation via Ctrl-c
IF ERRORLEVEL 3 ECHO preset error prevents file copy operation
Write disk error in the IF errorlevel 4 ECHO copy process
Whether or not the copy succeeds, the following:
Co
-resident memory), COMMAND. internal commands in COM (in memory at any time according to the memory environment), executable programs with the com Extension (directly loaded into memory by command.com ), executable programs with exe extensions (loaded into memory after command.com is relocated), and batch processing programs with bat extensions (analyzed by command.com, according to the content in the order of priority to call the 2, 3, 4, 5 executabl
intuitive:
Copy Code code as follows:
@goto: Bat
: Bat
@echo off
Echo I ' m batch!
Mshta "%~f0" Pauseexit
Note that the host here is Mshta, so the methods and properties of the WSH host are not supported (the alternatives to some properties or methods are detailed in the following text)But! Mshta is not good!Native support settimeoutNative support IFRAMENative sup
Tomcat starts batch processing -- catalina. bat, tomcatcatalina. batThis batch processing is the core script for tomcat server startup and shutdown. Including .... (Various variables). This section describes the logic of this batch.First look at the first part of the script:**************************************** **************************************** ************If not "" % 1 "" = "" run "" goto mainEntryIf "% TEMP %" = "" goto mainEntryIf exist "
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.