There are also reasons for introducing batch commands because some DLLs need to be compiled and copied to the following when using Jenkins to process integration the Web layer, otherwise reflection cannot be performed. All right, cut to the chase.
The batch file is a text file that is unformatted. include one or more articles. The extension is . bat or cmd. At the command prompt, type the name of the batch file, or double-click the batch file, and the system calls Cmd.exe to run them one by one in the order in which the commands appear in the file .
The following is a brief introduction to basic syntax usage
1echo command
Turn on or turn off the request Echo feature to display the current settings
echo [{on|off}][message]sample: @echo off/echo Hello World
[email protected] command
indicates no display @ the following command
You can't let the other person see the command you're using.
Sample: @echo Off@echo nowinitializing The program,please wait a minite ...
3goto command
Specifies to jump to the label, and when the label is found, the program processes the command starting from the next line.
Syntax: Goto label (label is a parameter that specifies the line in the batch program to which you want to turn.) )
4.Rem Command
Comment command, in C language equivalent to/*--------* *, it will not be executed, just a comment on the role, easy for others to read and your own later modification.
Rem Message
Sample: @Rem is the descr1ption.
5.Pause Command
Run Pause Command, the following message is displayed:
Press any key tocontinue ...
This command helps to display the desired results
Sample: @echo off:begincopya:*.* D:backecho put a newdisk into driver Apausegoto begin
in this example, the drive all files on the disk in A are copied to D:back.
6. If Command
if indicates that the criteria will be judged to be met, thereby determining the execution of different commands. There are three types of formats :
6.1,if " parameter " = = " string " command to execute
if the argument equals the specified string, the condition is set, run the command, or run the next sentence. ( note is two equals)
as if "%1" = = "A" format a:
If {%1}=={} gotonoparms
If {%2}=={} gotonoparms
6.2,if exist filename to execute command
If there is a specified file, then the condition is established, run the command, otherwise run the next sentence.
as if Existconfig.sys edit Config.sys
7 for command
command is a more complex command that is used primarily for parameters that loop through commands within a specified range
using in a batch file for command, specify the variable using the %%variable
the whole syntax is :
For{vaiable|%%variable}in (set) do command[commandlineoptions]
- %variable specifies a single-letter replaceable parameter.
- (SET) specifies one or a set of files. Wildcard characters can be used.
- Command Specifies the command to execute on each file.
- command-parameters specify parameters or command-line switches for specific commands.
The corresponding format can also be
For parameters   Percent of variable name In (" file or wildcard character do ( " action " )
These are the two variants of the writing, but the expression is the same meaning
Parameters for have a 4 a parameter /d/r/l/f , respectively .
- / D Table of Contents only
- / R Recursive
- / L iterated algebraic value range (lowercase l)
- / F Iterative File parsing
Let's get a recursive notation.
Search a directory for a copy of a file to another directory
Set Jbosspath=e:\jenkins_publish\examsystem_net\examsystem_service\binset Projwhich=examsystemset objectbll=% Jenkins_net%\%projwhich%\itoo. EXAM.BLL\OBJ\RELEASEFOR/R "%objectbll%"%%i in (Itoo*.dll) does (Echo is copying%%i to%jbosspath%copy/y "%%i"%jbosspath%<p >) </p>
Summary:
these are the Bat Basic script Learning and understanding, basic grammatical structure and command prompt, but also the most basic records of the current learning, a little to organize it.
Win batch processing command basic operation