what's the difference between command prompt and cmd?

10,948

Solution 1

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.

Solution 2

Command Prompt is simply a shortcut to cmd.exe named "Command Prompt":

enter image description here

The styling is just a result of the shortcut having its own properties. You could also have other shortcuts to cmd.exe and each of those could have their own style options as well.

As for the window title, cmd just sets the window title to the file name that launched cmd. If you create a shortcut to cmd.exe and call it "my_shell". You will get a cmd window titled "my_shell".

Share:
10,948
Musixauce3000
Author by

Musixauce3000

Updated on June 16, 2022

Comments

  • Musixauce3000
    Musixauce3000 almost 2 years

    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.

  • Musixauce3000
    Musixauce3000 over 8 years
    So you're saying when I type Command Prompt into the start menu, it's returning a shortcut to cmd.exe that's been titled with the formal name "Command Prompt" and that's the only reason anyone should ever see the words Command Prompt at the top of a cmd.exe window? -barring of course when user scripts explicitly include a line to set the title to Command Prompt -?
  • Andy Guibert
    Andy Guibert over 8 years
    @Musixauce3000 precisely. You can see for yourself if you do right click->Properties "Command Prompt" in your start menu. Or of you do right click->Open File Location it will take you to the file location of cmd.exe
  • Musixauce3000
    Musixauce3000 over 8 years
    Absolutely brilliant!
  • Mike Nakis
    Mike Nakis over 8 years
    Glad to be of help! (Another happy customer!) C-:=
  • Musixauce3000
    Musixauce3000 over 8 years
    Thank you so much. This combined with the answer from Mike has put me in a FAR better off place for understand the rest of the mess I couldn't even manage to get too in my question :p Thanks!
  • Harry Johnston
    Harry Johnston over 8 years
    Further to this, the command.com window also mentioned in the question is a completely different beast: that's the old MS-DOS command interpreter running in the 16-bit emulation environment. It is unlikely to be of use to most people, and is only available on 32-bit editions of Windows.
  • Musixauce3000
    Musixauce3000 over 8 years
    That's interesting Harry, because I am able to access it on my 64 bit windows 10 machine.
  • Mike Nakis
    Mike Nakis over 8 years
    @Musixauce3000 when was the last time you ran a virus checker?
  • Musixauce3000
    Musixauce3000 over 8 years
    Not since discovering I could access command.com... Perhaps I should do that.