Working with the Command Window


Charles Anderson

This is a brief tutorial on using the Command Window (also sometimes call a DOS window) under recent versions of Microsoft Windows.  This is by no means extensive; it's just the bare minimum to perform assignments that require access to the command window.

Starting Command Window

Open  a command window by finding the “MS-DOS Prompt” or “Command prompt” program, which is usually found under “Accessories”.  This should bring up the windows with the “>” prompt (which is usually proceeded by your current directory).
You can also start it from the Start->Run dialog box.  You can type "cmd" or "command".  They are somewhat different, but I've never taken the time to figure out the differences.  On campus, one of them has the PATH setup correctly to run Java, and the other doesn't.

Getting Around


Use dir to list the contents of your current folder (also known as a directory).
Use cd to change directories within the same drive.  Use cd .. to move up the directory hierarchy.
To change to a different drive, just type the drive letter (without cd).  For example, to change to your H: drive, just type H:
In most versions of the command window, you can use the up arrow key to see or repeat your previous command.  You can also edit it to fix mistakes.  Under Windows XP, you can type in a partial file name and hit Tab to fill out the rest of it.

Capturing Output

Cutting and pasting out of the command window is a pain.  First, right click on the window and select Mark.  Then, select a region of the screen to be copied with the mouse.  Then, right click on the title bar to select Edit|Copy.  Now, you can paste that into Notepad or Word.
If you need to capture more output than will fit in  one screen-full, so you will need to have scrollbars on the right-hand side of the window.  If you don’t see them, right click on the title bar of the window and select  Properties|Layout|screen buffer size to set the screen buffer size to at least 300 lines.  (This won’t work on windows 98, so you’ll have to cut and paste output one screen-full at a time and possibly use the more command.)




Last Updated: 29 April 2004