Digital Inspiration

about    faq    contact

Useful Keyboard Shortcuts for the DOS Command Prompt in Windows

command-prompt-shortcut-keys We look at some useful keyboard shortcuts and commands that will help you personalize the MS-DOS Command Prompt Window without using the mouse.

You will also learn about hotkeys for executing DOS commands more quickly. The keyboard shortcuts are known to work in Windows Vista and XP command prompt.

1. Change the color scheme of the DOS Window

dos color shortcutcolor bf - where b is the background color while f is for the foreground color (they are hex codes).

For instance, if you want to have a white background with black text, type color F0 and press enter. To revert to the original color scheme, type color without any arguments.

For a list of all available colors, type color /? on the command line.

2. Chant the Title of the Window to reflect the current time

dos-title-command

Do you know that you can put your name or your blog address in the title of the command prompt window. That’s like a neat watermark when you are using that screenshot for your website.

title your_name  %time%

That %time% will append the current timestamp to the Window’s title.

3. Navigate the Command History using Keyboard

If you have a long list of commands in the history, press the function key F7 to navigate through the history list using the arrow keys.

And if you already know the command number, press F9 and directly type that number. Very useful if you have to run some command repeatedly.

dos-command-history

4. Typing Long Commands at the DOS Prompt

You know the frustration when you type some long command only to realize that you made a typo or omitted typing some character. Either type the whole command again or a better option is the F1 key.

f2-dos-command F1 prints characters of the previous command one by one

Alternatively, you can press F2 to copy a certain number of characters from the previous command to the current one. Let me illustrate that with an example:

Say I want to run the command “nslookup www.google.com” but wrote “nslookup www.googlx.com” in a hurry.

Instead of retyping the whole thing, I can say F2 and then say x. This will print all the characters upto “x”. Then you can press F3 to complete the command or type it manually.

Related: Copy Command Line Output to Clipboard

Email This   Print Article   Save as PDF   Subscribe   Translate 

Published on March 19, 2008 under Software, Tips, Tricks, Tutorials
Tags: , , , ,

Recommended Google Software:

You may also like to read ..

 · Gifts for Geeks: Cushions Embroidered with DOS Directories
 · Screen Capture Partially Hidden Windows On the Desktop With SnagIt
 · Change the Font of Command Prompt Window to Consolas For More Comfortable Reading
 · How Fast Is Your ISP’s DNS Server; Compare with Speed of OpenDNS
 · Copy Command Line Output to Windows Clipboard Directly

Reader Comments

#1 Keith Dsouza 03.19.08

Wow these are great I never knew about the F7 and F2 trick, this will definitely come in very useful for me.

#2 Vivek 03.19.08

The F7 trick extremely useful.
You’re a real life saver, Amit :) Thanks

#3 Shashank 03.19.08

Great tips never knew these ones.

#4 Aaron 03.19.08

excellent, i never knew about these…

you should write about tab completion, i bet not many people use that feature. when typing in long file names, hit tab to auto-complete.

#5 anonymous 03.20.08

Also try F8 which cycles through already typed commands, kind of like Doskey,

#6 OT 03.20.08

“2. Chant the Title of the Window to reflect the current time” Should this be “Change …”? Sometimes chanting may be the only way to keep computers working … Many thanks for the tips!

#7 mattypenny 03.20.08

Something I found the other day as an alternative to F7:

doskey /history

It brings up the same list but in an easily cut-and-pasteable form.

#8 Anonymous 03.20.08

It should not be called the MS-DOS command prompt, because the system is no longer called MS-DOS. It has not been MS-DOS for over ten years now.

It is the (Microsoft) Windows command prompt.

#9 Jim 03.20.08

This only works for 1 session, when I close cmd and then reopen it is back to white on black.

Jim

#10 Anonymous 03.21.08

I find that it’s much more useful to set the time with the prompt command, since the window’s title is only updated once.

For example, I run the following for my command prompt:
prompt $c$d$s$t$f$_$p$g
title %username%@%computername%

Which produces a prompt that looks like this:
(Fri 03/21/2008 20:25:30.40)
C:\>

Far more useful IMHO.

@Jim
You need to create a batch file that runs the commands for you, then launch cmd.exe so that it calls this batch file first.

For example:
cmd.exe /k “H:\customprompt.bat”

Add a Comment

If you have a question that is not related to the above discussion, please post your question in the message board for quick answers. All comments are moderated.



 

Joing the Facebook Group

Visit Help Central

 

© 2008 Digital Inspiration - Technology, à la Carte | Mobile Edition | Videos | Terms

The articles are copyrighted to Amit Agarwal and can only be reproduced given the author's permission.

My Google  Netvibes  My Yahoo!  Windows Live  Bloglines  Newsgator  

Skip to top of the page ^^