Helping people with computers... one answer at a time.

COMMAND.COM and CMD.EXE are versions of the command interpreter for MS-DOS and Windows. They're both available, but you only really need one.

I've seen references to both "COMMAND.COM" and "CMD.EXE" as being called "the DOS prompt" in Windows XP. When I run each, via Start-Run, they seem similar, and yet I can tell that there are differences. For example I can't figure out how to "CD" to the "Program Files" directory using COMMAND.COM. What are they, and which should I use?

My advice is simple: forget about COMMAND.COM. It has a long, and venerable history, but for most practical purposes, it's no longer needed.

Understanding why is a trip down memory lane for MS-DOS and Windows.

As you probably know, MS-DOS was the predecessor to Windows. It was character mode only, and you ran programs by typing their name at the command prompt. MS-DOS was created when 16 bit processors were becoming popular, and its widespread adoption is credited with kick starting the rise in popularity of the personal computer.

Then two things happened: Windows, and 32 bit processors. Fast forward to today, and MS-DOS has pretty much disappeared from the landscape - Windows, and its rich graphical interface, is everywhere. The same is true for the 16bit processor. Most all contemporary machines are built on various flavors of 32bit processors.

What does all that have to do with COMMAND.COM and CMD.EXE? It's quite simple really: CMD.EXE is a command line processor for 32bit Windows. Much like MS-DOS before it, it provides a character-mode only user interface into which you can type commands to run programs. CMD.EXE is a 32 bit program that is fully a part of Windows - in fact it's what gets run when you select Command Prompt on the Windows Accessories menu.

COMMAND.COM, on the other hand, exists only for compatibility and 16bit programs. It exists solely for those programs which have not been updated since the days of MS-DOS. It's designed to run 16bit applications, and operates just like the old MS-DOS did.

On the surface, they're very similar. Even though CMD.EXE was a complete re-write, it's based on the same concepts and similar syntax. But the differences become quickly apparent. Let's used your "CD" example from above.

In CMD.EXE, you can change to the "Program files" directory by doing this:

cd "\Program Files"

Note the quotes around the directory name. Try doing that in COMMAND.COM and you'll get this:

cd "\Program Files"
Parameter format not correct -  "\program

The problem is COMMAND.COM doesn't know about long file names (filenames longer than 8.3) or filenames that have spaces in them, and it doesn't have a way to quote the name. So if you still need to, how do you CD to that directory in COMMAND.COM? Well, first you need to find out the alternate, 8.3 name of that directory ... its short name:

dir /x

 Directory of C:\

08/21/2005  09:50 AM    <DIR>          PROGRA~1     Program Files

(I've removed some of the lines of output for brevity.) The "/X" parameter to DIR tells it to include the "shortname" in the output. In this case that's "PROGRA~1", a machine generated alternative name for "PROGRAM FILES". Now we can CD to that in COMMAND.COM:

cd progra~1

 Volume in drive C is 
 Volume Serial Number is B026-62CA

 Directory of C:\PROGRA~1

08/21/2005  09:50 AM    <DIR>          .
08/21/2005  09:50 AM    <DIR>          ..
03/24/2005  04:42 PM    <DIR>          Adobe

The bottom line is actually quite simple: use CMD.EXE unless you know you need COMMAND.COM for compatibility with some older 16bit program. And even then, if you try and run a 16 bit program in CMD.EXE, it will typically run it within COMMAND.COM for you anyway, so you still may not need to know or care.

And in case you're wondering, yes ... something similar is coming down the road as 64 bit processors begin to arrive. The 64bit version of Windows does, I believe, include another command processor, one for native 64bit command-line programs.

Article C2412 - August 26, 2005 « »

Leo Leo A. Notenboom has been playing with computers since he was required to take a programming class in 1976. An 18 year career as a programmer at Microsoft soon followed. After "retiring" in 2001, Leo started Ask Leo! in 2003 as a place for answers to common computer and technical questions. More about Leo.

Not what you needed?

December 18, 2006 4:09 AM

Simply Wow! You really solved my lots of problems

January 11, 2007 5:11 AM

Excellent stuff. It gave me a clear idea of both.

March 2, 2007 9:54 PM

it cleared my doubt in an instance :)

anekant jain
March 19, 2007 4:28 AM

Amazingly ,in few lines you cleared all.

April 23, 2007 2:36 PM

Thanks for the detailed Information !!

May 6, 2007 3:19 AM

thanks a lot!!!

Magic Cat
June 4, 2007 5:15 AM

Nice explaination. Short and sweet :D

Mahesh Butani
September 15, 2007 4:14 AM

Perfect, and to the dot.

Jason Aranha
October 8, 2007 10:14 AM

good very nice, cleared my doubt for long

khurram irfan
December 3, 2007 7:00 AM

Really a nice explanation! Thanks

January 31, 2008 2:11 AM

For the past 2 hours I am trying to access 'my documents' with the command prompt and was frustatingly reaching nowhere. You cleared it within one minute :)........You are great, thanks a million :D

February 15, 2008 5:39 AM

I have a friend that is getting a type error approximately 1 minute after bootup, while sitting at the desktop . error is: c:\windows\system32\configuration\ Parameter not correct c:\document
Obviously cannot find the "documents and settings" folder. What would cause to start up and be giving this error. It is a WinXP system. Leo, can you or anyone else explain this to me?

June 5, 2008 10:07 AM

that's cuz some shortcut is pointing to 'documents and settings' trough command.exe, try to find the shortcut file, then edit it and change the name to docume~1 or whatever it is.

September 13, 2008 6:33 PM

what is the difference between directory and command

dilip baraskar
September 18, 2008 8:26 PM

Thanks Nice explaination

Tim Holst Petersen
September 30, 2008 10:33 AM

One thing you do NOT get "off the shelf" with 'cmd.exe' is the 'history' though'. '' just keeps on going, going, going.

With 'cmd.exe' you have to tweak it to see, not what you typed, but what the output was. If you start a program or a batch job which results in thousands of lines of feedback.... initially you will have a problem with cmd.exe. NOT with

'' does it good-old-style DOS ways.... it just keeps on going. IOW you can just scroll back and back and back. No fancy-pancy true-type fonts though.

I didn't try it, but I guess that if you exeed the 64kB segment will submit to failure.

April 6, 2009 11:55 AM doesn't maintain a history of the commands run previously (in the same session of course!) , whereas cmd.exe maintains a relly long (configurable) history

September 24, 2009 5:10 PM

Wow, thanks much for the tech note. Gets very frustrating when you know something is supposed to work, but it does not and you can quickly search and find a fast solution. Wish all of computer life were this easy :) ~SL

October 15, 2009 11:09 PM

if i open cmd.exe is it still possible to get
cd progra~1

Directory of C:\PROGRA~1
is this possible in cmd.exe ?

P Henry
April 16, 2010 7:48 AM can still be extremely useful for running applications when a pc is infected with malware. A lot of the malware prevents cmd.exe but not

October 7, 2010 6:48 PM


October 13, 2010 11:29 PM

Wow great article. I kept having problems with CD and had no idea it was bcus i was using command. Now I know it more than just cd, I had no idea it was an entirely different processor!

December 15, 2010 11:23 PM

when there is space in file name, the command was used "\Path of 1.dwg"\, this syntax will help to incorporate the spaces in file and it works on 32bit windows xp, and it doesnt work on windows7 64 bit system32.cmd.exe and on system64.cmd.exe windows 7

Comments on this entry are closed.

If you have a question, start by using the search box up at the top of the page - there's a very good chance that your question has already been answered on Ask Leo!.

If you don't find your answer, head out to to ask your question.