Delayed expansion acts weird in my for loop. At the first iteration
study is defined, at the second iteration it seems the delayed expansion doesn't work (delayed expansion is used just to strip the colon out because that will be the name of a directory). It is like that cypress command breaks something. Is that somehow related to how that cypress CLI works or there is something wrong with my script?
setlocal EnableExtensions EnableDelayedExpansion
IF "%~1"=="" GOTO endparse
IF "%~1"=="-s" SET studies=%~2
for %%a in ("%studies:,=" "%") do (
echo study %%~a delayedExString: !study!
npx cypress run -study=%%~a --config videosFolder=cypress/videos/!study! --headless --spec "cypress/integration/*"
myscript.bat -s "firstStudy:Chap1,secondStudy:Chap3"
study firstStudy:Chap1 delayedExString firstStudyChap1
study firstStudy:Chap1 delayedExString !study!
As you can see, in the second iteration study is not expanded.
PS: The tags are kind of wrong as there is no "batch" tag. Please note the script runs on a plain Windows 10 machine.