10 Windows command line tips and tricks

How to get the best from the Windows command prompt

10 Windows command line tips and tricks

Despite rumours you may have heard to the contrary, the Windows command prompt is far from dead. It's just gone a bit quiet lately, that's all.

The command prompt – or DOS prompt, if you refuse to let go of the past – still underpins Windows 7, and offers a quick and technical way of moving files about, listing directories and performing a wide range of back-end tasks that might not have a graphical interface.

There's a lot to learn about the humble prompt, and you can get more out of it with these helpful command line tips.

1. Customise it

The console's default colour scheme of white text on a black screen not doing it for you? It's surprisingly straightforward to alter the look of the command prompt.

Bring up a window by typing cmd into the Windows 7 search box, or the 'Run' dialog if you're using an older version of the OS. Right-click the title bar and select 'Properties', then go to the Font tab to choose from a few different typefaces.

The Colours tab lets you determine the hue of both selected and unselected text; if the standard shades don't take your fancy, you can use the 'Selected colour values' boxes to choose custom colours.

2. Make it better

By default, the command prompt is quite restricted in its scope. It's therefore worth tweaking a few of the values in the Properties dialog to make it bigger and improve its memory.

Select the Options tab and set the buffer size to 500 to increase the number of previous commands to be stored by the prompt, then toggle 'Discard old duplicates' to stop it remembering your every use of the 'dir' command.

Now go to the Layout tab and make the screen buffer height somewhere around 1,000, and increase the window height to a more reasonable 50 lines.

3. Add functions

Quite why Quick Edit, which is accessible from the Options tab, is switched off by default is quite beyond us. Switch it on and you'll be able to copy text by dragging it and then right-clicking the mouse in the command prompt. You can then paste text into the prompt by right-clicking without dragging. Intuitive.

4. Quick command prompts

Opening up a command prompt is usually a pretty long-winded exercise that involves a lot of tedious typing, followed by the hassle of having to navigate to the specific folder that you want to work in. But there's an easier way to go about it.

In Windows Explorer, hold the [Shift] key and right-click the folder in which you want to open a new prompt, then simply select 'Open command window here'.

You can also open a command prompt with elevated administration privileges with a minimum of fuss by right-clicking the folder while holding down the [Shift]+[Control] keys.

5. Try an alternative

While it's not possible to replace the Windows command line, there are plenty of shells that give it a more advanced interface. Try out PowerCmd for a multi-pane interface that enables you to do a lot more, or search for 'GlassCmd' to give the console a Windows 7-style look.

Console will give you a tabbed interface, but for a more powerful take, try Take Command from www.jpsoft.com.

6. Use the keys

Can't be bothered typing that super-long string again? Use the [Up] key to bring up the most recently used command. Keep pressing it to browse through your history, or use the [Down] arrow to move forward in time. You can also hit [F7] to bring up a formatted list.

7. Tab Completion

If you're interacting with a file or folder, start typing the filename and hit [Tab]. Provided it's in the folder you're working in, the name will be auto-completed. If there are other files with the same start string, hit [Tab] again to skip through them.

8. Drag and drop

There's a second way to fill in filenames and folders, and it's arguably even easier than the previous method. Just click and hold an item in an Explorer window, then drag it to the command prompt and drop it there, and Windows fills in the filename and path automatically.

9. Change some names

The command title enables you to, rather pointlessly, alter the title bar of the command window from the current directory to whatever you affix to the end of it. The command prompt does the same for the C:\> part of the shell itself.

10. Use the history keys

Did you know that you can type the previous command one letter at a time by hitting [F1] repeatedly? This is a handy way of getting to the part you got wrong if you're retyping the last entry. Try using [F2] and [F3] as well – we'll let you discover exactly what they do.


First published in PC Plus Issue 300

Liked this? Then check out 25 cool Windows 7 interface tweaks

Sign up for TechRadar's free Weird Week in Tech newsletter
Get the oddest tech stories of the week, plus the most popular news and reviews delivered straight to your inbox. Sign up at http://www.techradar.com/register

Follow TechRadar on Twitter * Find us on Facebook

Article continues below