• Welcome to Freedom Reborn Archive.
 

How to open a Windows command prompt (XP) and change folders in it

Started by stumpy, February 14, 2007, 08:14:18 PM

Previous topic - Next topic

stumpy

This comes up once in a while, so I thought it may be worth describing briefly here.

Opening a Windows Command Prompt

There are (at least) three easy ways to open a Windows command prompt.


  • Go to the Start Menu and choose Run... then enter cmd in the dialog that opens up.
  • Go to the Start Menu and navigate to Programs -> Accessories -> Command Prompt. (Some people have Command Prompt in Programs -> Administrative Tools or even in Programs -> Administrative Tools -> System Tools.)
  • (This is what I recommend most.) Install the Windows Power Toy that lets you right-click on a folder and start a command prompt that is already open in that directory. That will save some CDing around once you have the command prompt window open. To install this, go to http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx and install the CmdHere.exe program (which you can search for on the page, using your browser).

Changing Directories at the Command Prompt

Once the command prompt window is open, you often want to look at or run programs that are in a particular folder/directory. Unless you choose the third method of opening the prompt window mentioned above, this means you will have to use the cd command to change directories. For instance, if you are in the C:\temp folder and you want to get to C:\temp\spiff, you just enter cd spiff at the command prompt.

If you want to go up (or "out") one directory, enter cd .. (which would take you, for instance, from C:\temp\spiff to C:\temp). If you want to go all the way to the "top" or "root directory" of the current drive in one shot, enter cd \ at the prompt.

If the folder you want to change to has a space (or other odd character) in it, you can enclose it in quotation marks. For example, to change from C:\ to C:\Program Files, just enter cd "Program Files" at the command prompt.

If you want to go several directories deeper, you can cd to each, one after another,
C:\>cd "program files"

C:\Program Files>cd games

C:\Program Files\games>cd "Freedom Force vs The 3rd Reich"

C:\Program Files\games\Freedom Force vs The 3rd Reich>

or all at once
C:\>cd "Program Files\games\Freedom Force vs The 3rd Reich"

C:\Program Files\games\Freedom Force vs The 3rd Reich>


Setting the Size of the Command Window

The default commmand window is useful, but if you use it much, you will want to set it up so that you can see more of the information that would otherwise scroll off the screen.


  • Click on the little command prompt icon in the upper-left corner of the command prompt window and choose Properties.
  • Choose the "Layout" tab. I recommend setting the width to 80 in both the Screen Buffer and Window sizes. Then, set the Screen Buffer height to something large, like 300, 500, or even 1000. Set (or keep) the Window Size height at 25 so it doesn't take up too much space on your desktop.
  • In the "Options" tab, I recommend making sure QuickEdit Mode and Insert Mode are checked.

Misc.

If you have the QuickEdit Mode and Insert Mode options checked (see above), you can select text in the command window by dragging over it with the left mouse button down. Then you can copy that selected text to the clipboard by clicking with the right mouse button.

Clicking in the command window with the right mouse button when no text is selected will paste text currently in the clipboard to the command prompt.

You will find it useful that the command line history remembers commands you have already entered and you can get to them using the up and down arrow keys. You can edit/change a line using the right and left arrow keys, as well as delete, backspace, etc.

Handy Hints

BTW, I recommend this link to a cheat sheet of commonly used command prompt commands: http://www.geocities.com/tlawlessrr/dos.htm

BentonGrey

Haha!  Thanks Stumpy, ignorant fellows like me will really appreciate this :D