0
votes

I have simple script with word SETUP_0x as var:

SET SETUP_01=DIR C:\
SET SETUP_02=netsh advfirewall firewall add rule name="Notepad" dir=in action=allow program=C:\Windows\Notepad.exe
SET SETUP_03=MD C:\Test


(FOR /f "tokens=2 delims==" %%a in ('SET SETUP_') DO (
  call :Log *****************************************
  call :Log %%a
  call :Log *****************************************
  %%a
)) >> %LogFile%

Output of this code is something like:

DIR C:\ 
netsh advfirewall firewall add rule name
MD C:\Test

On variables SETUP_01 and SETUP_03 works, but when my script runs on var SETUP_02 it take only command from first delimiter = to second one = , so output of the command is:

netsh advfirewall firewall add rule name

So my question is:

In this case its possible to take rest after first delimiter (=) even there are more delimiters in this line to have:

netsh advfirewall firewall add rule name="Notepad" dir=in action=allow
Try for /F "tokens=1* delims==" %%I in (set SETUP_') do %%J`…aschipfl
@aschipfl Thanks so much! Command is working OK now: (for /F "tokens=1* delims==" %%I in ('SET SETUP_') DO (%%J))MikeZetPL