How to batch echo output value is from another file, and the content is a variable, how to parse it?
example:
env.bat
@echo off
set a=123
set b = 456
set dev_env=%a%
set prod_env=%b%
copy_env.bat
@echo off
for /f "skip=1 eol=: tokens=2,3 delims== " %%i in (.\env.bat) do (
setlocal enabledelayedexpansion
set key=%%i
set value=%%j
echo !key!=!value! >> .\custom_variable.properties
endlocal
)
output: this is not what I want
dev_env=%a%
prod_env=%b%
output: I want ....
dev_env=123
prod_env=456
%a%and%b%to actually exist. Stick acall env.batat the top of copy_env.bat and also fix your third line in env.bat so that you're setting%b%correctly.