cmd: Fixed var substring in 'enableDelayedExpansion' mode.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55402
This commit is contained in:
Dmitry Sokolov 2023-08-24 23:42:43 +03:00 committed by Alexandre Julliard
parent bd10252332
commit 7e4715149a
3 changed files with 17 additions and 1 deletions

View file

@ -1275,6 +1275,17 @@ set x=C:\Program Files (x86)
if ""=="" set y=%x%\dummy
echo %y%
echo --- Testing if + var subst in delayed expansion mode
setlocal enableDelayedExpansion
for %%i in (abc 10.0 11.0) do (
set result=%%i
echo [DEBUG] checking {!result!}
if "!result:~0,3!"=="10." (
echo SDKVER=!result!
)
)
endlocal
echo ------------ Testing for ------------
echo --- plain FOR
for %%i in (A B C) do echo %%i

View file

@ -927,6 +927,11 @@ x@space@
A
------------ Testing if/set ------------
C:\Program Files (x86)\dummy
--- Testing if + var subst in delayed expansion mode
[DEBUG] checking {abc}
[DEBUG] checking {10.0}
SDKVER=10.0
[DEBUG] checking {11.0}
------------ Testing for ------------
--- plain FOR
A

View file

@ -596,7 +596,7 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start, WCHAR startchar)
/* If there's complex substitution, just need %var% for now
to get the expanded data to play with */
if (colonpos) {
*colonpos = startchar;
*colonpos = '%';
savedchar = *(colonpos+1);
*(colonpos+1) = 0x00;
}