Windows Cmd /C Enters Interactive Mode

Windows Cmd /C Enters Interactive Mode

A friend of mine has a Windows 10 system that shows the following behavior:

When GNU make is used to run a command using "cmd /c" and the command string contains a wildcard character, then the invoked cmd.exe does not terminate (as documented for the /c option) but stays in interactive mode.

Example makefile:

clean:
        @echo makefile: making clean
        -cmd /c del /s *.pyc
        @echo makefile: made clean

Invoking make:

(prompt) > make clean
makefile: making clean
cmd /c del /s *.pyc
Microsoft Windows [Version 10.0.17134.523]
(c) 2018 Microsoft Corporation. All rights reserved.
(prompt) >

When entering exit, the makefile continues:

makefile: made clean

So obviously the cmd /c ... invokes the command processor in interactive mode.

When the asterisk is removed, that does not happen:

Example makefile:

clean:
        @echo makefile: making clean
        -cmd /c del /s x.pyc
        @echo makefile: made clean

Invoking make:

(prompt) > make clean
makefile: making clean
cmd /c del /s x.pyc
The system cannot find the file specified.
makefile: made clean
(prompt) >

This happens exactly when an asterisk is in the command line, or when double quotes are used (as in cmd /c "del /s x.pyc").

I have never seen such a behavior before, and i don't have Windows 10 to try it out myself.

Does anyone know why it enters the command processor in interactive mode?

3
Alexander Ross
Author

Alexander Ross

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.