Step 1: Understanding Command Prompt
- The Command Prompt environment is very different from Windows Explorer, but remember that it is simply another way to access and move your files. Once you're familiar with the ways in which Command Prompt differs from the more visually familiar Windows Explorer it will be much easier to get started with the basic commands for Command Prompt. The two most important differences to prepare for:
There are no icons, only text!
- Everything is represented by text. You see where a file is based on its location in a list, which is itself contained in a folder.
- Think of Command Prompt's display like navigating Windows Explorer under the Details view. If you're unfamiliar with this view, try it out before you take a crack at Command Prompt.
- -In Windows Vista, open up any folder and there will be a pull-down menu marked Views. SelectDetails.
- -In Windows XP or earlier, open up any folder and there will be a View tab in the toolbar at the top of the window. Click it and select Details.
- Move around your hard drive in the Details view and get comfortable looking at your folders and files as text-only filenames rather than icons.
There is no clicking, only typing!
- This isn't 100% true, since some shortcuts will have you clicking a little bit (we'll cover them later with other, more advanced features). But these are merely exceptions to the basic rule that there will be no clicking.
- Navigating folders and managing your files will be done strictly through text commands once you get into Command Prompt.
- It might help to go back to the Details view in Windows Explorer and experiment with using your files with as few mouse clicks as possible. Practice a few mouse-less techniques:
- The box at the top of the window which displays the folder's location on your hard drive is called the Address Bar.
- -Try moving to different folders by typing their location into the Address Bar and hitting Enter.
- Move to parts of the window that you cannot arrow into by using the Tab key.
- -If you are in the file list and want to get to the Address Bar, pressing Tab to cycle through the different parts of the window until you get to the Address Bar.
- Selecting multiple files that are next each other in the list:
- -Press and hold Shift, then use the Up and Down arrow keys to highlight more files.
- -Let go of Shift when you have all the files that you want.
- Selecting multiple files that are scattered throughout the list:
- -Press and hold Ctrl, then use the Up and Down arrow keys to get to move around the list.
- -When you get to a file you want to select, press Spacebar to add it to the group.
- -Let go of Ctrl when you have all the files that you want.
- The box at the top of the window which displays the folder's location on your hard drive is called the Address Bar.
Step 2: Opening Command Prompt
- Command Prompt is included in all versions of Windows, but you will open it in different ways depending on which version. This is the only difference though; once Command Prompt is opened, you will be using it the same way no matter what version you're running.
- Through the Start Menu:
- Click on Start.
- Open the Accessories folder.
- Select Command Prompt.
- If for any reason you cannot find the folder, you can also open it manually:
- In Windows Vista:
- Click on Start.
- In the Start Search box, enter cmd
- In Windows XP or earlier:
- Click on Start.
- Click on Run and enter cmd.
- Command Prompt will start you off in your Windows Profile's default folder (C:\Documents and Settings\USERNAME\ in both Vista and XP). But if you already have a specific folder in mind that you need to get to, you can save a little navigation time with a Windows Vista trick uncovered by a developer:
- While holding the Shift key, right click on any folder.
- The menu that opens up will have an extra option marked Open Command Prompt Here.
- Command Prompt will open, pre-navigated to the folder which you right-clicked.
Step 3: Using Basic Commands
- Before you start tooling around, Command Prompt includes a help command that you should consult. Typing help will bring up a list of all its valid commands. And from here, typing help COMMAND NAMEwill give you more information about the specified command. But since the help function seems intended as a brief refresher, here is a proper introduction to the important basic commands.
Navigation
- dir will display the contents of your current folder.
- If there is too much to fit on the screen at once, use dir /p to go through the contents one page at a time.
- cd FOLDERNAME (or chdir FOLDERNAME) will access the specified folder. Note that you can only access files or other folders that are within your current folder.
- Example: If you are at C:\ and you want to access C:\BIGFOLDER\TARGETFOLDER\
- -Enter cd BIGFOLDER to get to C:\BIGFOLDER\
- -Now enter cd TARGETFOLDER to get to C:\BIGFOLDER\TARGETFOLDER\
- Example: If you are at C:\ and you want to access C:\BIGFOLDER\TARGETFOLDER\
- cd.. will move you up one folder.
- Example: If you are at C:\BIGFOLDER\TARGETFOLDER\
- -Enter cd.. to bring you up to C:\BIGFOLDER\
- Example: If you are at C:\BIGFOLDER\TARGETFOLDER\
- cd\ will bring you back to the root directory regardless of what folder you are currently in.
- Example: If you are at C:\BIGFOLDER\TARGETFOLDER\
- -Enter cd\ to bring you back to C:\
- Example: If you are at C:\BIGFOLDER\TARGETFOLDER\
- X: will change to another attached hard-drive or partition (where X is the letter name).
- Example: If you are at any folder in C:\
- -Enter D: to get to D:\
- Example: If you are at any folder in C:\
- exit will close the Command Prompt window regardless of what folder you are in.
- dir will display the contents of your current folder.
File Operations
- del (or delete) will delete a specified file.
- Note that it deletes your file immediately and does not send it to the Recycle Bin first. So be sure of what you want to delete.
- copy will put a copy of the input file to the specified output folder.
- Example: If you want to copy a file named test.txt
- -Enter copy c:\LOCATION\test.txt c:\LOCATION2\
- -Note that this will keep a copy in C:\LOCATION\ as well as place another copy of it in C:\LOCATION2\
- Example: If you want to copy a file named test.txt
- move will move an input file to the specified output folder.
- Example: If you want to move a file named test.txt
- -Enter move c:\LOCATION\test.txt c:\LOCATION2\
- -Note that unlike the copy command, move will not keep a copy in the original location. Now test.txt will only exist in C:\LOCATION2\
- Example: If you want to move a file named test.txt
- ren (or rename) will rename a file to a specified new filename.
- Example: If you have a file named test.txt
- -Enter ren C:\LOCATION\test.txt testing.txt
- -Now, test.txt has become testing.txt
- Example: If you have a file named test.txt
- del (or delete) will delete a specified file.
Folder Operations
- The copy, move, and rename commands all work the same way with folders as they do with files.
- del will delete all the files contained within a folder.
- Note that it does not delete the folder itself, nor any folders within it, only files.
- Example: You have a folder C:\LOCATION\ that contains a text file test.txt and a subfolder \SUBLOCATION\
- -Enter del C:\LOCATION, and test.txt will be gone, while \SUBLOCATION\ is still there, and completely unaltered
- rd (or rmdir) is how you delete a specified folder.
- Note that it must be empty, or else the command will not work.
- md (or mkdir) will create a folder at a specified location.
- Example: You have a folder C:\LOCATION\ with nothing in it
- -Enter md C:\LOCATION\Folder to create \Folder\ within C:\LOCATION\
- Example: You have a folder C:\LOCATION\ with nothing in it
- There are a few more advanced commands that Command Prompt accepts but, depending on your needs, you may or may not want to delve quite that deeply.
Step 4: Using Keyboard Shortcuts
- Despite the bare-bones nature of Command Prompt, there are still plenty of helpful hotkeys and built-in tools designed to minimize the otherwise silly amounts of typing you'll need to do in order to perform many tasks.
Arrow Keys
- Left arrow will move the cursor, like in a word processor. This way you can edit your command without having to delete what you've already typed.
- Right arrow will rebuild the last command you entered, character by character.
- The Up and Down arrows will cycle through previously entered commands.
Function Keys
- Each of the Function Keys (F1-F9) recall your previously entered commands in different ways. While a couple of them are very similar to the arrow keys, many of them are notably more advanced:
- F3 will immediately display your last entered command so you don't have to rebuild it one character at a time.
- F7 will list your command history in a menu so you can select a particular entry.
- -Alt-F7 will clear your command history which is useful if you only want to track a certain series of entries
- F8 will cycle through your previously entered commands. But unlike the Up and Down shorctuts, if you specify a few characters F8 will only cycle through commands that begin with that string.
- -Example: If you type cd, F8 will cycle through all your Change Directory commands.
Give Command Prompt a Makeover
- If you're planning on using it more often, it will soon be obvious that Command Prompt isn't going to win any beauty pageants. At least not in its default state. Thankfully, it is flexibly designed so you cancustomize the display settings to make the program both easier on the eyes and more efficient, too.
- Open a Command Prompt window and click on the icon in the top left corner.
- Click on Properties to bring up a customization menu
- In this menu, you can change things like font size and background color to suit your taste.
- It also contains a few handy technical options. Of particular importance:
- Editing the Command History Buffer Size will increase the number of commands you can recall with the arrow keys.
- Editing the Screen Buffer Size will allow you to scroll back further in the Command Prompt window so you can keep track of what you've been doing.
- When you've dolled up your Command Prompt window to your liking, make sure to save the changes!
- Close the Properties menu.
- A dialog box titled Apply Properties will pop up.
- Select Save properties for futures windows with same title.
The Wildcard Operator
- * (the asterisk symbol) is called the wildcard operator, an evocative name for a powerful tool. Proper use of the wildcard will allow you to apply a file or folder command over multiple targets at once. For example, if you wanted to delete all the files in a folder that contain the string "photo" in the filename, you would have to do a lot of squinting and clicking in Windows Explorer. With the wildcard operator in Command Prompt, you can use a single command to do the same thing. Placing the wildcard in different places in text will target specific portions of text:
- Wildcarding all targets ending with certain letters:
- Example: You have a folder of music in both .mp3 and .wma format, and need to delete all the .wmafiles
- -Navigate to the specific folder with your MP3s and WMAs.
- -Enter DEL *.wma and only mp3 files will remain in the directory.
- Example: You have a folder of music in both .mp3 and .wma format, and need to delete all the .wmafiles
- Wildcarding all targets starting with certain letters:
- Example: You want to move to your Documents and Settings from C:\
- -Enter CD Doc* and you will be directed to C:\Documents and Settings
- Note that you have to provide enough letters to specify a unique target name. If you had another folder in C: called Doctors, you would have to enter at least CD Docu* to specify a unique folder
- -Enter CD Doc* and you will be directed to C:\Documents and Settings
- Example: You want to move to your Documents and Settings from C:\
- Wildcarding all targets containing certain letters:
- Example: You want to list all the files in a folder that have the word "photo" in the filename
- -Enter DIR *photo* and you will see a list of all the files, regardless of format, that have "photo" in the name
- Example: You want to list all the files in a folder that have the word "photo" in the filename
Troubleshoot Your Wireless Network
- Networking on your computer already seems like weird, alien magic, so it should be no big surprise that Command Prompt, itself rather unfamiliar to most users, is a common tool in troubleshooting your network settings. The command ipconfig has a number of different uses in managing your network settings in Windows.
- Regardless of your current folder in Command Prompt, typing ipconfig will display your network information, including your local and network IP Address. There are also a few additional features built into the command that are commonly used in troubleshooting networks:
- ipconfig /all will display more information about both the network and your computer's specific network settings.
- ipconfig /release will clears out any network IP addresses associated with your computer.
- ipconfig /renew will reinitialize your IP address on your network.
- -Running ipconfig /release and then ipconfig /renew is a basic step that is commonly recommendedto fix an unresponsive network connection.
- Another neat trick that Command Prompt has come to be known for is the ability to help you delete difficult files. If you have a file that Windows insists is in use by another program when you know that it isn't, or cannot be accessed when you know it can, the DEL command can help you get around this common problem in Windows.
Monday, January 17, 2011
Understanding Command Prompt
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment