When the parentheses are passed within some parameter or variable into a for
loop such as this one in a cmd script:
for /f „usebackq tokens=1–5“ %%S in (sc %PAR%) DO (IF /I
[„%%U“] EQU [„FAILED“] (endlocal & exit /b %%V))
where in this case %PAR% may be an SDDL string containing parentheses –
even escaping them won't help. The escaping is gone when the %PAR% is replaced
with the parameters content and breaks the for loop when it is finally
executed.
Parameterizing for loops with parameters containing parentheses
When the parentheses are passed within some parameter or variable into a for loop such as this one in a cmd script:
for /f „usebackq tokens=1–5“ %%S in (
sc %PAR%) DO (IF /I [„%%U“] EQU [„FAILED“] (endlocal & exit /b %%V))where in this case %PAR% may be an SDDL string containing parentheses – even escaping them won't help. The escaping is gone when the %PAR% is replaced with the parameters content and breaks the for loop when it is finally executed.
Does anybody know a way around this?