I have Windows 7, Windows 8 and Windows 10 systems and they all behave similarly.
When I type command prompt into the start menu and press enter, a window titled Command Prompt appears. I gave it a blue background and a green text. When I type start, cmd, or the name of a bat file into the command line, it opens up a window titled cmd, which I gave a background of black and a green text. It seems the colors get stored but... hmm...
When I type cmd into the start menu of Windows 10, a Window titled "cmd" appears, but it recalls the blue background and green text from the Command Prompt window, but typing cmd
from that window opens a new one styled black and green. When I double click a batch file, it opens up a window titled command prompt with a different font face and a black background with white text. When I type command
it just prints the DOS and copyright headers, but start command
opens up a window titled COMMAND.COM with the different font face and the black background with white text.
When type cmd /?
into a list of parameters appears in on the screen. One of them is /Q. It says it turns echo off in the new instance. When I type cmd /Q
in either command prompt or cmd, it replaces the window with another using the same title but the black and green color scheme, and does NOT turn off echo. When I type start cmd /q
, exactly the same thing occurs, but 'start cmd.exe /q' actually produces an error stating that /Q isn't a valid switch.
This really is only a fraction of the problem I'm facing here, and I can't even begin to start sorting it out. If some veteran out there who knows all the subtle differences between the apparent grove of command prompts, and ways of calling them, I'd appreciate that person sorting that mess out for me.
I will try to clear up some of the confusion, but I cannot do a perfect job, because Microsoft has made sure to make the mess impossible to completely untangle, and they change the mess with every version of windows. So, for example, some of the information I am about to provide might not apply to Windows 8 and Windows 10. But it did apply up until and including Windows 7.
"Command Prompt" is the formal name of the console application under windows. "cmd.exe" (or just "cmd") is the name of the executable binary file of that same application.
Windows stores the default settings for the command prompt in the registry, under HKEY_CURRENT_USER\Console
. When a new command prompt opens, windows takes the window title of that command prompt, and tries to see whether there is a subkey under HKEY_CURRENT_USER\Console\
with that name. If it finds a subkey, it reads the values from it. If it does not find a subkey, it reads the default values it finds in HKEY_CURRENT_USER\Console
.
For example, on my system, there exists a HKEY_CURRENT_USER\Console\MySQL 5.6 Command Line Client - Unicode
key, most probably because the MySQL installer created this key so that their command prompt looks different from other instances of the command prompt. Of course, in order for this to work, the shortcut which starts their command prompt must specify "MySQL 5.6 Command Line Client - Unicode" as the window title of the command prompt.
So, if you are seeing command prompts with different styling, that's probably because you have entries under HKEY_CURRENT_USER\Console\
. And the fact that it does not appear to make any sense is due to the fact that the subkey selected depends on the title of the command prompt window, which may differ depending on how you start it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With