A friend of mine said, that we don't need to restart the script using "%SystemRoot%\System32\cmd.exe /c ...", we only need "setlocal enableExtensions".
I couldn't believ it because it contradicts "setlocal /?", so i tested it (via registry disabling (HKCU + HKLM) and "cmd /E:OFF",
starting batch by doubleclick the icon and typing to cmd-prompt), and it works on my winxp home/prof and win 10 prof 32 bit.
Tested using:
Code: Select all
@echo off
echo CMDCMDLINE=%CMDCMDLINE%
setlocal enableExtensions
echo CMDCMDLINE=%CMDCMDLINE%
pause
pause
endlocal
goto :eof
Output:
Code: Select all
CMDCMDLINE=
CMDCMDLINE=C:\WINDOWS\system32\cmd.exe /c ""C:\Users\Ulf\Desktop\test.bat" "
"C:\Users\Ulf\Desktop\test.bat"
Drücken Sie eine beliebige Taste . . .
Drücken Sie eine beliebige Taste . . .
Because i don't know how to, i haven't tested the case "extensions disabled by group policy",
but i hope, the behaviour is the same:
Could anybody confirm this (or tell me howto set this via group policies)?
It would also be nice, if someone coud check this on all other windows versions.
penpen