diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd index 73b0917c275..c7418b759e4 100644 --- a/programs/cmd/tests/test_builtins.cmd +++ b/programs/cmd/tests/test_builtins.cmd @@ -3149,6 +3149,9 @@ echo %ErrorLevel% should be 7 if errorlevel 7 echo setting var worked too well, bad call :setError 3 echo %ErrorLevel% should still be 7 +rem Verify that (call ) sets errorlevel to 0 +(call ) +if errorlevel 1 echo errorlevel should have been 0 echo ------------ Testing GOTO ------------ if a==a goto dest1 diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index 47e43fcd675..2b55a39dca3 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -1053,6 +1053,11 @@ void WCMD_run_program (WCHAR *command, BOOL called) firstParam = WCMD_parameter(command, 0, NULL, FALSE, TRUE); if (!firstParam) return; + if (!firstParam[0]) { + errorlevel = 0; + return; + } + /* Calculate the search path and stem to search for */ if (wcspbrk (firstParam, delims) == NULL) { /* No explicit path given, search path */ static const WCHAR curDir[] = {'.',';','\0'};