X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/2cae8632b75245e232030244159963287ffc6231..ad67503f50b8d2c443e63cb16863b39ad8345567:/src/w32proc.c diff --git a/src/w32proc.c b/src/w32proc.c index 38452917ad..09e0c0530a 100644 --- a/src/w32proc.c +++ b/src/w32proc.c @@ -1078,6 +1078,7 @@ create_child (char *exe, char *cmdline, char *env, int is_gui_app, DWORD flags; char dir[ MAX_PATH ]; char *p; + const char *ext; if (cp == NULL) emacs_abort (); @@ -1116,6 +1117,15 @@ create_child (char *exe, char *cmdline, char *env, int is_gui_app, if (*p == '/') *p = '\\'; + /* CreateProcess handles batch files as exe specially. This special + handling fails when both the batch file and arguments are quoted. + We pass NULL as exe to avoid the special handling. */ + if (exe && cmdline[0] == '"' && + (ext = strrchr (exe, '.')) && + (xstrcasecmp (ext, ".bat") == 0 + || xstrcasecmp (ext, ".cmd") == 0)) + exe = NULL; + flags = (!NILP (Vw32_start_process_share_console) ? CREATE_NEW_PROCESS_GROUP : CREATE_NEW_CONSOLE);