How to declare variables in bat file

The way to declare variables in the bat file is as follows:

set xxx_variant_name=yyyyyyyyyyyy

move D:\abc\efg\test.txt %xxx_variant_name%\test.txt

illustrate:

    01. The sentence of set is to declare the variable xxx_variant_name and assign the variable yyyyyyyyyyyyy

    02. When using variables, you need to add % before and after

 

Example:

if not exist NewFolder md NewFolder

set DestFolder=D:\abc\efg

move D:\abc\efg\test.txt %DestFolder%\NewFolder\test.txt

Supongo que te gusta

Origin blog.csdn.net/xiaowang_lj/article/details/132040290
Recomendado
Clasificación