How do I use the Windows command prompt line?
Now I know how to open a command prompt in Microsoft Windows, how do I perform common tasks in a command prompt? Can you show me some command prompt basics and perhaps something cool I can do to impress my friends?
You already know how to open a command prompt, which is required in order to run certain commands and prompts in Windows.
When you think about the Windows command prompt, just imagine that you're traveling back in time and are working on a computer that was state of the art back in, oh, the early 1990s, maybe, or even a bit earlier. No mouse, no icons to click on, no windows, no pretty pictures. Just text. You type, the computer responds. That's it.
Here, let me remind you of what it looks like...
Here are some tips and tricks to help you get more comfortable with the command prompt environment.
First, read how to copy and paste in a command prompt window, which was worth a separate article unto itself. You can't be comfortable with a Windows utility until you know how to copy and paste with it.
Here's a simpler trick: Re-entering a command without having to type it again. Type the command "ipconfig" in a command prompt and you'll see this output, which includes your computer's IP address:
To enter the command "ipconfig" a second time, without having to type the command again, hit the up-arrow key on your keyboard, and the word "ipconfig" will reappear in the command prompt.
The command prompt has a memory of all the recent commands that you typed in (up to 50 commands, by default), so that you can iterate back through your recently entered commands by hitting the up-arrow key repeatedly. For example, after typing "ipconfig" and hitting Enter, try typing "ver" and hitting Enter. (You should see "Microsoft Windows XP [Version 5.1.2600]" or something similar depending on your version of Windows.) Hit the up-arrow key, and the "ver" command will re-appear since it was the last command you entered. But hit the up-arrow key again, and the "ipconfig" command will re-appear. (This buffer of recently-typed commands gets erased when you close the command prompt, so if you close the command prompt window and open another one, hitting the up-arrow key will not recall commands that were entered in the previous command prompt window.)
By default, a new command prompt window opens with a "working directory" of
Sometimes, in order to run a command that applies to a specific file on
your computer, you need to change your working directory to the directory containing
that file. For example, consider the "tree" command,
which displays a list of all the directories within a directory, and a list of
sub-directories within each of those directories, etc. I want to display
the tree of all subdirectories within the directory
There are two ways that I can do this. The first way is to enter the full path
to the directory in the command. "C:\Program Files\Common Files\Adobe\TypeSupport"
is the "full path" to the directory. However, if I try entering "tree" followed
by the full path to the directory:
This is because the command prompt considers whatever comes after the "tree" command
to be the first argument to the tree command -- basically, the thing that
the tree command "operates on" -- however, it stops reading at the first space, after
the word "Program". Then it gets confused by the next glob of characters, "Files\Common".
In order to get the "tree" command to take the entire full path as an argument, we
need to put quote marks around the full path:
The second method would be to change the working directory to
Once you have changed the current directory to
One final note about changing directories using "cd". If you want to switch to a directory that begins with a different drive letter -- for example, if your working directory is "C:\Documents and Settings\" but you want to change to the directory "D:\" -- then the "cd" command won't work:
Instead, to change to a different drive, just type the drive letter by itself, followed by a colon:
That will switch your working directory to a new drive letter.
And that's it! With these basics, if you encounter any instructions page telling you to run a certain command "within a command prompt", but that doesn't explain the basics of navigating inside a command prompt, these tips will probably take care of 90% of the situations that you'll run into.
Bennett Haselton is a technology blogger who will gladly buy you a latte if you let him talk to you about how to bypass K9 Bluecoat web filters.
More Useful Windows PC Help Articles:
✔ What's the easiest way to speed up my Windows PC laptop?
My Dell Windows 7 laptop is starting to drive me crazy. It's so darn slow! I've had it a few years and I...✔ Can I force a Windows 7 OS system update?
Every so often Windows 7 pops up a window and tells me that there are updates. That's nice, but how can I force...✔ Fix Google Drive (Gdrive) no longer supported (out of date)?
I'm a big Google fan and have been using Google Drive for quite a while as a cloud storage device. It's a breeze,...✔ How do I open or unpack a RAR archive on my Windows PC?
I have some ".rar" files on my Windows 8 PC and am curious how to unpack them to see what's inside. From a...✔ How can I shrink my Windows 8 Desktop file icons?
I've figured out most things in the new Windows 8 interface, except I can't see how to easily reduce or shrink the file...
Let's stay in touch!
Sign up for my weekly AskDaveTaylor Newsletter and you'll receive even more tech and gadget help right to your inbox, along with exclusive news and industry updates. It's good stuff. I promise!
I do have a comment, now that you mention it!
Check This Out Too...
Look for Answers
All Our Categories
Apple iPad Help
Articles and Reviews
Auctions and Online Shopping
Blogs and Blogging
Building Web Site Traffic
Business and Management
Computer and Internet Basics
d) None of the Above
Google Gmail Help
Google Plus Help
Industry News and Trade Shows
iPhone and Cell Phone Help
iPod, Sony PSP and MP3 Player Help
Kindle Fire Help
Mac OS X Help
Pay Per Click (PPC) Advertising
Search Engine Optimization (SEO)
Shell Script Programming
Tech Support Video Help
The Writing Business
Twitter, LinkedIn and Social Network Help
Unix and Linux Help
Video Game Tips and Help
Windows PC Help
Find Me on Google+
ADT on G+