问题
i want to do something like this
1.bat
var1=The bot now At %PlaceName%
2.bat
SET PlaceName=Hotan
Echo %var1%
it should be like:
The bot now At Hotan
but it is shown like:
The bot now At %PlaceName%
回答1:
1.bat
@echo off
setlocal
set "var1=The bot now At !PlaceName!"
call 2.bat
2.bat
@echo off
setlocal EnableDelayedExpansion
SET PlaceName=Hotan
Echo %var1%
Another way:
1.bat
@echo off
setlocal
set "var1=The bot now At %%PlaceName%%"
call 2.bat
2.bat
@echo off
setlocal
SET PlaceName=Hotan
call Echo %var1%
来源:https://stackoverflow.com/questions/36958759/batch-script-how-to-set-variabes-inside-another-variable