我想做这样的事情
1.BAT
var1=The bot now At %PlaceName%
2.bat
SET PlaceName=Hotan
Echo %var1%
应该是这样的:
The bot now At Hotan
但显示如下:
The bot now At %PlaceName%
答案 0 :(得分:0)
<强> 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%
另一种方式:
<强> 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%