你的意思不是很清楚,但这里很可能是你需要的信息:
@echo off
setlocal
set "_1=VSC"
set "PLATFORM=x64"
set "EXE_PATH_%_1%_%PLATFORM%=%ProgramFiles%\VSC\bin"
set "EXE_PATH_NAME=EXE_PATH_%%_1%%_%%PLATFORM%%"
set "EXE_PATH_NAME=%EXE_PATH_NAME%"
set EXE_PATH_
endlocal
此批处理代码输出例如:
EXE_PATH_NAME=EXE_PATH_%_1%_%PLATFORM%
EXE_PATH_VSC_x64=C:\Program Files\VSC\bin
有必要使用CALL来扩展 value 中的变量EXE_PATH_NAME
,即根据JosefZ设置变量的注释,使用此批处理代码多一行EXE_PATH_VALUE
:
@echo off
setlocal
set "_1=VSC"
set "PLATFORM=x64"
set "EXE_PATH_%_1%_%PLATFORM%=%ProgramFiles%\VSC\bin"
set "EXE_PATH_NAME=EXE_PATH_%%_1%%_%%PLATFORM%%"
call set "EXE_PATH_NAME=%EXE_PATH_NAME%"
call set "EXE_PATH_VALUE=%%EXE_PATH_%_1%_%PLATFORM%%%"
set EXE_PATH_
endlocal
此批处理代码具有附加call
输出,例如:
EXE_PATH_NAME=EXE_PATH_VSC_x64
EXE_PATH_VALUE=C:\Program Files\VSC\bin
EXE_PATH_VSC_x64=C:\Program Files\VSC\bin
但我真的不明白为什么要搞得这么复杂。