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
color 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
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.
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.
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
Find this article at: http://www.labnol.org/software/tutorials/useful-keyboard-shortcuts-for-the-dos-command-prompt-in-windows/2629/
Tags: Archives, command prompt, DOS, dos commands, windows, Software, Tips, Tricks, Tutorials
Reader Comments
Wow these are great I never knew about the F7 and F2 trick, this will definitely come in very useful for me.
Written by Keith Dsouza on 03.19.08
The F7 trick extremely useful.
You’re a real life saver, Amit :) Thanks
Written by Vivek on 03.19.08
Great tips never knew these ones.
Written by Shashank on 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.
Written by Aaron on 03.19.08
Also try F8 which cycles through already typed commands, kind of like Doskey,
Written by anonymous on 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!
Written by OT on 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.
Written by mattypenny on 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.
Written by Anonymous on 03.20.08
This only works for 1 session, when I close cmd and then reopen it is back to white on black.
Jim
Written by Jim on 03.20.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”
Written by Anonymous on 03.21.08
So how about F3 to repeat the last command.
comes in real handy for pinging a lot of different IP’s . just change the last number before hitting enter.
Written by Sam Liberato on 05.20.08
Hey how come I never heard of F7 and F2 shortcuts before :?
Thanks for great tip. :)
Written by Suda on 05.28.08
1.how to format removable flash disk using dos command
2.how to delete one item in a removable flash disk using dos command
3is it possible to scan virus in flash disk using dos command ?
Written by herbert on 06.17.08
use the up arrow at cmd prompt, much much more quicker
Written by shawn on 07.16.08
Hi,
if you want to copy a command from other window to the command prompt(which is not in full screen). just copy the text by Ctrl+C and right click in the command prompt it will paste the text which is in the clipboard..
Written by Dass on 09.18.08
my f8 key is not working give me substitute key for that.
Written by RAMAN KUMAR on 09.30.08
Hi all, can someone please tell me how to get from C:\users\wes to C:\
I am using Vista and this is what I get when I open my DOS prompt. It actually says Administrator:Command Prompt at the top of the prompt box.
Many thanks for the help I know I will recive Waz
Written by Wez on 10.08.08
Can anyone tell me how to delete a virus using command prompt
Written by floyd3000 on 11.17.08
When am tryin to change the path it is not beig changed…For example my path is set as c:\documents and settings\destop\priya
if i want to change as c:\program files it does not change.what should i do for that to change?
Written by priya darshini on 12.21.08
hye priya…
for changing path you first write cd and then the file name or else u can create a batch file at
c:\documents and settings\destop\priya
this location with following content
cd\
cd c:\program files
then save it as “d.bat”
now when u open cmd just write d and hit enter…
Written by sagar on 12.29.08
Hey Wez Did you ever get to know how to delete a virus manually?
Sorry I have come in four months down the line are you still on?
may be we can share the little knowledge I gut
Written by EJ Cheej on 01.03.09
Hi,
I’m a new IT student and need to know the following:
On the Ms-dos command prompt screen.
1). Change the drive to hard disc. Is this [C:\>] ?
2). Issue the command that enables you to change the date.
3). Steps to follow to change date.
4). Issue the command that enables you to change the time.
Thanks!
Chris..
Written by Chris Begarly on 01.23.09
Hi there.I was surfing the net that I encountered your website.I hope you can help me.I am having a problem with my windows xp.As you know the “search” and “Run” options are in start menue but I cannot see them, why?where they have gone?
besides the “command prompt” option in accessories does not work.what’s the problem?
Regards.
Written by mohammad on 04.24.09