How to handle properly environment values starting with numbers in cmd.exe. (eg.3DSMAX_xxx)

StackOverflow https://stackoverflow.com/questions/22138444

  •  19-10-2022
  •  | 
  •  

Question

I tried to use an environment value in cmd.exe like below,

set MAX_PATH=%3DSMAX_2011x64_PATH%
echo %MAX_PATH%
set MAX_PATH

However it looks like the %3DSMAX_2011x64_PATH% always is treated as a DSMAX_2011x64_PATH.

I searched the answer for a day however I couldn't find it.

How can I handle it properly?

No correct solution

OTHER TIPS

The short answr is - don't use variablenames starting with a numeric. The reason is that %n with n numeric means "parameter n to the procedure".

If you absolutely must use such names, then

for /f "tokens=1*delims==" %%v in ('set') do if /i "%%v"=="3name" set "newthing=%%w"

This will set the value:

set MAX_PATH=3DSMAX_2011x64_PATH
echo %MAX_PATH%
set MAX_PATH
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top