批处理脚本如何在另一个变量中设置变量

Batch Script How to Set Variabes inside another variable

我想做这样的事情

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%

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%