This information is stored as a part of the PEOptHeader
portion of the EXE binary format. Specifically the Subsystem
field tells the operating system what type of application this is and can have the following values
- 1: Native
- 2: Windows/GUI
- 3: Windows non-GUI
- 5: OS/2
- 7: POSIX
This is what tells windows what type of program it is and hence gives it the ability to make different choices as cmd does.