windows command line evaluate inner variable expression
I want to set environment variables based on a text file. The text file has the following format name=value
In my script i simply iterate the file and perform a set command:
FOR /F "tokens=* delims=" %%A IN ('type test.ini') DO (
SET %%A
)
The problem is that the text file can contain something like folder=%HOMEPATH%\test
The set command does not evaluate the %HOMEPATH% environment variable. Instead of \Users\john\test the variables value is %HOMEPATH%\test.
Is there a way do accomp开发者_运维百科lish this?
Thanks!
Use: CALL SET %%A
then.
CALL will itself expand %%A and then SET will expand %HOMEPATH%.
精彩评论