当前位置:网站首页>Bat script learning (I)

Bat script learning (I)

2022-07-06 21:54:00 qq_ one billion four hundred and ten million eight hundred and

Reprint :BAT Batch file set Detailed command _ Wang Yu Wan Feng's blog -CSDN Blog _ The batch set command  

Reprint :BAT Script learning —— Basic grammar _Word Brother's blog -CSDN Blog _bat Basic script syntax

First, you can follow the VScode Script writing , Again according to code runner Conduct script testing .vscode Really invincible .

Catalog

One : Print information :echo

Two : A blank line :echo. ( Comma realizes an empty line )

3、 ... and : Annotation mode

Four : Implementation of judgment statement

5、 ... and : Building links

6、 ... and : Start the program

7、 ... and : Implementation calls other bat file

8、 ... and :%cd% and %~dp0 The role of

One : Print information :echo

Two : A blank line :echo. ( Comma realizes an empty line )

3、 ... and : Annotation mode

:: notes             ( No display )

rem notes         ( Show )

@ notes            ( The terminal does not display , But it can do @ What's in it , You can hide messages )

Four : Implementation of judgment statement

among A Represents a space . Space should be added .

Determine whether a variable is defined

Determine whether a file exists

5、 ... and : Building links

1. Copy file   :/h

 2. Create folder shortcuts : /j

6、 ... and : Start the program

The format is :  start + Space + quotes + Space + Program directory

7、 ... and : Implementation calls other bat file

call: Call another batch file ( If not call And directly call other batch files , After executing the batch file, you will not be able to return to the current file and execute the subsequent commands of the current file ).

1. First create a shortcut for other folders

2. call call Command to execute other bat file

3. Create new shortcuts for other folders

8、 ... and :%cd% and %~dp0 The role of

%cd% : Get the working path of the current file

%~dp0 : Gets the of the current file Can only be used in batch files , It is determined by the directory location of the batch file it is in , It's batch processing , The drive letter where the file is located :+ route

Nine : Realization if The function of judgment and

原网站

版权声明
本文为[qq_ one billion four hundred and ten million eight hundred and ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207061332205641.html