GEGeek's How To Series 02/08/08 The Command Line Part 3 - Tips and Tricks The Command Line Part 5/5 The Command Line Part 4/5 The Command Line Part 3/5 The Command Line Part 2/5 The Command Line Part 1/5 The Command Line Again, my intention here is not to teach you DOS, but to point out some features and facts about working at the command line that you may not have known before. Tips for Using the Windows Command Prompt
Stopping a runaway command Sometimes you start a command only to find that it is going on and on, spewing out screen after screen of output. Most of the time you can terminate a command by simultaneously pressing the two keys "CTRL" and "c". This is known as the “break” command, which can also be issued with the “CTRL” + BREAK keyboard sequence.
Pausing a scrolling screen If you have a command with a lot of output, you can pause the scrolling so that you can read what's on the screen. Use the keyboard combination"CTRL+S". To resume scrolling, repeat CTRL+S
Use drag and drop Having to type the fully qualified path of a file every time it's needed in a command can be tedious and subject to error. Many people are unaware that a file can be dragged from a folder or Windows Explorer view and dropped on an open command window. It saves a lot of typing. (Doesn't work in Vista)
Go up one level above the working directory To go up to the parent directory that is one level above the working directory, enter cd .. You can repeat this to go up more levels.
How to change the working directory to a folder on a different drive If you want to change the working directory for a command window to a folder on a different drive, the command "cd" doesn't work. You have to first enter the drive letter and colon ( d: then enter ) and then enter "cd" to change to the desired folder path. However, you can use the switch /d to change to the current working directory drive in one command line using the following command: cd /d d:\test
Watch out for spaces in file and folder names The command shell does not recognize spaces in path names. Any path name with spaces must be enclosed in quotation marks. So if you are going to be referring to a folder name such as Program Files, you need to enclose the name in quotes. Use the designation “Program Files” so it recognizes the space in the name.
Pin a command-line shortcut to the Start menu If you use the command prompt frequently, make it easily accessible. Open Start-All Programs-Accessories and right-click the entry "Command Prompt". Select "Pin to Start menu" from the context menu.
Create a shortcut to a command If there is a command that you use frequently, you can create a shortcut. The trick is to use the switch /k so that the command prompt stays open. The entry for the shortcut should be cmd /k somecommand.exe If the command also needs switches, those can be added as well.
Open Windows Explorer from the command line To open the current command-line directory in a Windows Explorer window use the command: start . To open the directory above the current command-line directory in a Windows Explorer window use the command: start ..
Save typing with file-name and folder-name completion Those of you familiar with Linux will recognize this command. A very useful feature that can save a lot of typing is the name or path completion function. This feature uses the Tab key to complete file and folder names that you begin typing. The tab key tries to anticipate what file or command you could be looking for. You start typing in the command, but don’t finish it. Instead you hit the tab key and it tries to finish the command for you. It’s better illustrated by an example. Open a command window.
Type in “cd” and a space as if you were going to change to another folder. Before you enter the name of the folder to change to hit the tab key. Now keep hitting the tab key. Notice that it’s listing all the possible folders you could change to. When the one appears that you want to change to hit enter. The list that the tab key will show you depends on the command you issued. Cool Huh?
Display the Command History The default setting for the command window stores up to 50 of the previously entered commands. The command history can be displayed by entering the "F7" key. Hope this was informative GEGeek
|