From: Eric Pouech epouech@codeweavers.com
+ COMSPEC should be set to the path of running cmd.exe instance if not present, + PROMPT must be set to $P$G if not already defined.
Signed-off-by: Eric Pouech epouech@codeweavers.com --- programs/cmd/wcmdmain.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index 7ad835ed25d..1b6a3ea6f2f 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -4461,11 +4461,11 @@ static void WCMD_setup(void) /* initialize some env variables */ if (!GetEnvironmentVariableW(L"COMSPEC", string, ARRAY_SIZE(string))) { - GetSystemDirectoryW(string, ARRAY_SIZE(string) - ARRAY_SIZE(L"\cmd.exe")); - lstrcatW(string, L"\cmd.exe"); + GetModuleFileNameW(NULL, string, ARRAY_SIZE(string)); SetEnvironmentVariableW(L"COMSPEC", string); } - SetEnvironmentVariableW(L"PROMPT", L"$P$G"); + if (!GetEnvironmentVariableW(L"PROMPT", string, ARRAY_SIZE(string))) + SetEnvironmentVariableW(L"PROMPT", L"$P$G");
/* Save cwd into appropriate env var (Must be before the /c processing */ GetCurrentDirectoryW(ARRAY_SIZE(string), string);