As we’ve discussed before, the command line in a Windows environment is an incredibly powerful tool for simplifying or speeding up many common Windows systems administration tasks. However, there are several “meta” tips and tricks that can make you even more efficient when interacting with the Windows command line interface itself – either the PowerShell prompt, or the classic DOS/batch style prompt.
Here are a few Windows command line tips to get you started. Most of these tips below may seem like basic, simple, or even obvious tasks, but when used regularly, they can save you a lot of typing – and time.
Open Windows Explorer
Even though you’re on the command line, sometimes you need to drop back into Windows Explorer to interactively navigate the file system in the directory your command prompt is currently working in. Rather than manually open Windows Explorer and browsing to the location again, or rather than copying and pasting the path out of your command prompt, simply type: “start .” (no quotes).
This will open Windows Explorer and have it start in the same same path as your command prompt’s working directory.
When you’re typing out a path in a Windows command prompt, start pressing the tab key after you’ve entered a character or two. The command prompt will try to auto-complete what you’re looking for based on the context of the path from your working directory or relative to the the partial path you’ve already entered.
Keep pressing the tab key to cycle through all the options available to you based on your current context. The command prompt will also automatically wrap quotes around any paths that contain spaces.
Sometimes you need to repeat a command you already ran in your current command prompt session. Or you need to run a similar command that’s just a slightly modified version of something you already ran. Rather than retype the entire command, simply use your up and/or down cursor keys to navigate through your command history. Once you find the command you wanted to run again, simply press Enter again.
Before you execute a command, while it’s still waiting at the prompt, you can quickly jump the cursor around through the existing command text at the prompt. If you need to make slight adjustments to parts of your command, rather than start at the end and delete your way back to the part you need to change, use the Home and End keys to quickly navigate to the beginning or end of the command line respectively.
Hold down the Control key while using your left and right cursors to quickly jump between “words”, i.e. space separated “chunks” of the command text.
If you’re ever in the situation where you have Windows Explorer, or some other graphical UI open next to your command prompt, and you somehow need to reference the full path to a file or directory from that UI in your command prompt, don’t retype the path to that file. Simply drag and drop it into your command prompt.
Windows will even put quotes around the path if it contains spaces.
Obviously there are many more ways to make efficient use of the Windows command line. If you have any other tips, let us know in the comments below.
On an unrelated note we wanted to thank all of you, our readers, for checking us out this past year. We’ll have lots more to come in 2014. Happy New Year!