diff --git a/Wurstpack/wurstscript/grill.cmd b/Wurstpack/wurstscript/grill.cmd index 76b86578a..f8640bc20 100644 --- a/Wurstpack/wurstscript/grill.cmd +++ b/Wurstpack/wurstscript/grill.cmd @@ -1,8 +1,8 @@ @echo off -setlocal +setlocal EnableExtensions DisableDelayedExpansion -rem Save current code page -for /f "tokens=2 delims=: " %%A in ('chcp') do set "_OLDCP=%%A" +rem Save current code page (extract number after ':') +for /f "tokens=2 delims=:" %%A in ('chcp') do for /f "tokens=1" %%B in ("%%A") do set "_OLDCP=%%B" rem Switch to UTF-8 for this session chcp 65001 >NUL @@ -38,3 +38,4 @@ rem Restore previous code page if we captured it if defined _OLDCP chcp %_OLDCP% >NUL endlocal +exit /b %ERRORLEVEL% diff --git a/Wurstpack/wurstscript/wurstscript.cmd b/Wurstpack/wurstscript/wurstscript.cmd index 0fecaf520..95000308f 100644 --- a/Wurstpack/wurstscript/wurstscript.cmd +++ b/Wurstpack/wurstscript/wurstscript.cmd @@ -1,8 +1,8 @@ @echo off -setlocal +setlocal EnableExtensions DisableDelayedExpansion -rem Save current code page -for /f "tokens=2 delims=: " %%A in ('chcp') do set "_OLDCP=%%A" +rem Save current code page (extract number after ':') +for /f "tokens=2 delims=:" %%A in ('chcp') do for /f "tokens=1" %%B in ("%%A") do set "_OLDCP=%%B" rem Switch to UTF-8 chcp 65001 >NUL @@ -34,3 +34,4 @@ if not exist "%JAVA%" ( :restore if defined _OLDCP chcp %_OLDCP% >NUL endlocal +exit /b %ERRORLEVEL%