In my scipt i’m getting a string from a file and i would like this string to be interpreted as a var:
for /f %%G in (..\..\outrep.txt) do SET AUTOIMPORTDIR=%%G
In my outrep.txt file I have: %USERPROFILE%
So I would like AUTOIMPORTDIR equals to C:\Documents and Settings\myUser
and it’s actually equals to %USERPROFILE%
What can i do to interpret this string as a Variable?
In this situation you can use one more instance of
FOR /Fto evaluate the string%USERPROFILE%using the option to execute theECHOcommand:Important detail: the
tokens=*option is necessary if the value you want to fetch includes spaces or tabs.