I found the code for my loop in this answer. Now I modified to loop a bit to match my needs and now it looks like this:
for /f "delims=" %%x in (test-config.txt) do (
call set "%%x"
echo %%x |findstr /b "SERVICE_NAME" >nul ||(
call set "def=%%def%% --"%%x""
) || (
echo
)
)
the loop reads a file with following format:
par1=val1
par2=val2
par3=val3
and its working as needed. Now I want to add some comments in between the lines like this:
par1=val1
par2=val2
//value is not default
par3=val3
sadly the loop now tries to create a parameter with the comment as name and no value. Can you show me how I have to enhance my loop to ignore the comment lines? Please note that a value could also include //