I import variables from config.txt
to my .bat
file.
The following is the content of my config.txt
:
param1 = %LOCALAPPDATA%\Programs
param2 = %LOCALAPPDATA%\Programs\Myfolder
This is my .bat
file content:
for /f "delims=" %%L in (config.txt) do set %%L
echo %param1%
This outputs:
%LOCALAPPDATA%\Programs
But I want it to output:
C:\Users\Alaska\AppData\Local\Programs
If you want another round of variable expansion, use the call
command.
If you need the variable to contain %LOCALAPPDATA%
, then use it in front of the echo
command:
for /f "delims=" %%L in (config.txt) do set %%L
call echo %param1%
If you want the variable to be expanded to its full value, use it in front of the set
command:
for /f "delims=" %%L in (config.txt) do call set %%L
echo %param1%