IanG on Tap

Ian Griffiths in Weblog Form (RSS 2.0)

Blog Navigation

April (2018)

(1 item)

August (2014)

(1 item)

July (2014)

(5 items)

April (2014)

(1 item)

March (2014)

(1 item)

January (2014)

(2 items)

November (2013)

(2 items)

July (2013)

(4 items)

April (2013)

(1 item)

February (2013)

(6 items)

September (2011)

(2 items)

November (2010)

(4 items)

September (2010)

(1 item)

August (2010)

(4 items)

July (2010)

(2 items)

September (2009)

(1 item)

June (2009)

(1 item)

April (2009)

(1 item)

November (2008)

(1 item)

October (2008)

(1 item)

September (2008)

(1 item)

July (2008)

(1 item)

June (2008)

(1 item)

May (2008)

(2 items)

April (2008)

(2 items)

March (2008)

(5 items)

January (2008)

(3 items)

December (2007)

(1 item)

November (2007)

(1 item)

October (2007)

(1 item)

September (2007)

(3 items)

August (2007)

(1 item)

July (2007)

(1 item)

June (2007)

(2 items)

May (2007)

(8 items)

April (2007)

(2 items)

March (2007)

(7 items)

February (2007)

(2 items)

January (2007)

(2 items)

November (2006)

(1 item)

October (2006)

(2 items)

September (2006)

(1 item)

June (2006)

(2 items)

May (2006)

(4 items)

April (2006)

(1 item)

March (2006)

(5 items)

January (2006)

(1 item)

December (2005)

(3 items)

November (2005)

(2 items)

October (2005)

(2 items)

September (2005)

(8 items)

August (2005)

(7 items)

June (2005)

(3 items)

May (2005)

(7 items)

April (2005)

(6 items)

March (2005)

(1 item)

February (2005)

(2 items)

January (2005)

(5 items)

December (2004)

(5 items)

November (2004)

(7 items)

October (2004)

(3 items)

September (2004)

(7 items)

August (2004)

(16 items)

July (2004)

(10 items)

June (2004)

(27 items)

May (2004)

(15 items)

April (2004)

(15 items)

March (2004)

(13 items)

February (2004)

(16 items)

January (2004)

(15 items)

Blog Home

RSS 2.0

Writing

Programming C# 5.0

Programming WPF

Other Sites

Interact Software

Know Your Command Prompts

Thursday 4 March, 2004, 07:59 PM

Apparently lots of people don't realise that the DOS Prompt, and the Windows Command Prompt are not the same thing. They're actually two different programs - COMMAND.COM and CMD.EXE respectively.

I've seen lots of people struggle on with the DOS Prompt, bitching quietly under their breath about how crummy the command prompt is in Windows, without realising that they're using the wrong one. (In case you're wondering why I've seen lots of people do this, one of the various things I do for a living is teach stuff to software developers, so I get to see the way lots of different developers use their machines.) It's an easy mistake to make, particularly if you're in the habit of launching programs from the Run... dialog. (This is really convenient once you've discovered the WindowsKey-R shortcut. Unless of course you have a laptop without a Windows key.) If you type in COMMAND at the Run... dialog, a command prompt appears. And if you don't spend much time at the command line you may not notice the problem. But you will if you're a seasoned command line user. (I have four open right now - how about you?) You will instantly recognize that something is wrong, because this appears:

Microsoft(R) Windows DOS
(C)Copyright Microsoft Corp 1990-2001.

C:\DOCUME~1\IAN>

DOS? DOS!?! And even if you didn't bother to read the banner, there's another big clue that all is not well right there in the prompt: look - a mangled filename! That's another big clue that we're in the world of DOS, not the world of Windows. And as if further proof were needed, if you look in your task list after launching COMMAND.COM, you won't find an entry for COMMAND.COM (unless you've enabled the listing of 16-bit processes), but you will find NTVDM.EXE - the Virtual DOS Machine.

So this is not the Windows command prompt, it's the DOS command prompt. And as such, it doesn't support history or command completion, or most of the other features that make the Windows command prompt a reasonably productive tool once you get to know it. Of course, because it's DOS, you can run good old DOSKEY to get command line history back. But you're better off just running the Windows command prompt. You can even launch 16-bit apps from the Windows command prompt if you really need to. The only possible reason for using COMMAND.COM is if you have a specific backwards compatibility requirement that forces you to use it rather than CMD.EXE. What you want to be seeing is something like this:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\ian>

The thing that prompted me to post this was that I was just reading Junfeng Zheng's blog. A recent item points out a useful resource for those new to the Windows command prompt. The first comment contains some typically unedifying Linux chest thumping, but it also made me think that whoever wrote the comment had fallen into the classic rookie mistake of confusing a DOS prompt with a Windows Command prompt. (Despite what the guy claims, Windows has supported auto completion since the early days of NT. Not quite sure what he means by 'memorizing' though - I couldn't find any reference to that in any of the documentation for any of the shells installed on my local unix-like boxes. But I did find one bash reference on the web that uses that term to describe command line history. If that's what he meant, I bet he was using the DOS prompt!)

Copyright © 2002-2024, Interact Software Ltd. Content by Ian Griffiths. Please direct all Web site inquiries to webmaster@interact-sw.co.uk