When you open a Command Prompt window,Windows starts the CMD.EXE program. CMD prompts for commands and executes them, until you close the window or type the exit command.There are several ways to open a Command Prompt window:
- Click Start, All Programs, Accessories, Command Prompt.
- On Windows 7, open a Command Prompt window as just described, right-click its icon in the task bar, and select Pin This Program to Taskbar.The icon is now always available.
- Click Start, and type cmd in the Search box.When the cmd.exe result appears, press Enter or click it.
- On Windows XP, or if you have customized the Start menu to show the Run command, click Start, click Run, type cmd, and press Enter.
You can change the properties of any of these shorcuts to preset the initial working directory. By default, it's your account's user profile folder.
Tip: You can also start a Command Prompt window from any Windows Explorer view, with a folder preselected as the current directory. This is a handy trick to know. In Windows 7 and Vista, hold down Shift, right-click a folder name in any Windows Explorer view, and select Open Command Window Here. On Windows XP, search www.microsoft.com for "Open Command Open Here Power Toy" and install it. This gives you Open Command Prompt Here as a right-click option on any folder without holding down the Shift key.
You can also open additional Command Prompt windows from the command line or from batch files, if there's a need.To open a new window from the command prompt, type start cmd.You can alter CMD's behavior by specifying additional command-line arguments.
Tip: A good time to open an additional Command Prompt window is when you need to perform privileged administrative tasks. Describe this in the next section.
In this tutorial:
- The CMD Command-Line
- CMD Versus COMMAND
- Running CMD
- Opening a Command Prompt Window with Administrator Privileges
- CMD Options
- Disabling Command Extensions
- Command-Line Processing
- Console Program Input and Output
- Using the Console Window
- I/O Redirection and Pipes
- Copy and Paste in Command Prompt Windows
- Command Editing and the History List
- Name Completion
- Enabling Directory Name Completion
- Multiple Commands on One Line
- Grouping Commands with Parentheses
- Arguments, Commas, and Quotes
- Escaping Special Characters
- Configuring the CMD Program
- The Search Path
- Changing the Path
- Predefined and Virtual Environment Variables
- Setting Default Environment Variables
- Built-in Commands
- Extended Commands
- Listing Files with the Dir Command
- Paginating Long Listings
- Printing Directory Listings
- Sorting Listings
- Locating Alternate File Streams
- Setting Variables with the Set Command
- Conditional Processing with the if Command
- Scanning for Files with the for Command
- Using the for Command's Variable
- Processing Directories
- Numerical for Loop
- Getting More Information