The Windows Command PromptUnder Windows, you can open a command-prompt window by clicking on the Command Prompt entry under the Accessories submenu. You can also type cmd in the Start menu search box (Vista) or in the Start menu Run field (XP).
The command prompt typically shows you the current working disk and directory:
C:\Documents and Settings\Adam>
In this example, the current working directory
is the home directory \Documentsand
Settings\Adam on the
C:
disk. Under Vista, the location of the home directory is slightly different:
C:\Users\Adam>
From
the command prompt, you can run many useful commands we’ll see some as we progress through this book. Two standard commands that are important to know for this book are:
cd
Changes your working folder or directory on disk.
dir
Lists the files and directories in your working folder.
Together, the cd and dir commands are the text equivalent of using a graphical file manager such as Windows Explorer to go to different directories and view their contents.
Windows uses the variable
%HOMEPATH%
to
refer to your home directory, so you can always change to your home directory by typing:
C:\>
cd %HOMEPATH%C:\Documents and Settings\Adam>
Command completion and historyCommand completion is a feature that can save you a lot of typing. When you start
to type the name of a command, file, or directory, pressing the completion key sequence cycles through matches. The completion key varies between
systems it is generally theTab key or the Ctrl-D or Ctrl-F key combination.
Under Windows, you can activate the command-completion feature if you start the command prompt with the
/f:on option (command completion
is active by default inVista). If the
/f:on switch doesn’t work on your system, try calling the cmd program without the switch. You can also configure Windows XP to have command
completion active by default, but we won’t describe how to do this here.
The best way to understand command completion is to try it out. For example,
when you type Share with your friends: