When I open cmd.exe and type this first line and press ENTER, it works fine. When I enter this other line and press ENTER, it closes immediately.
I can change ('a') to ('asdfgh') the same. or% q to% of the same problem.
The difference is that / f, for some reason FOR / F with ('......'), causes cmd.exe to close.
This happens on one of my systems and not on the other
C:\>for %q in ('a') do echo %q <ENTER>
C:\>echo 'a'
'a'
C:\>for /f %q in ('a') do echo %q <ENTER>
source
share