One of the best and most consistently beneficial sources of information on TechRepublic is the community membership. This simple fact was proven again when the membership came through with improvements to a previously published tip on command prompt history.
One of the primary guiding principles of TechRepublic is that the community is where the knowledge lies. The membership continues to be one of the best and most consistently beneficial sources of information at TechRepublic, and that fact was proven yet again when members chimed in to offer improvements to last week's Windows XP tip on command-prompt histories -- "Avoid Frustration and Display a Full Windows Command-Prompt History."
Last week, Greg Shultz showed you how to get a history of the commands typed at the command prompt. The command was simple enough:
doskey /historyYou'll see a full listing of all the commands that you've entered in a current session (Figure A).
A list shows that my last few commands have been ping commands.
Member mytmous offered this enhancement to Greg's tip:That's a good tip, but I've always just used the F7 key, which will open a window that shows the list of commands. This also allows you to simply use the arrow keys and hit ENTER on one of the commands if you need to reuse it (Figure B).
Typing F7 gives you a pop-up window with your command-prompt history.
Member Kiwi.Dusty offered this list of command-prompt function keys and their results:
- F1 retypes the previous command one character at a time
- F2 brings up a dialog box that asks "Enter the char to copy up to:"
- F3 retypes the last command in full
- F4 brings up a dialog box that asks "Enter char to delete up to:"
- F5 as for F3
- F6 prints EOF character (Ctrl+Z)
- F7 brings up a dialog box of all the recent command history
- F8 brings up each of the most recent commands, one at a time
- F9 brings up a dialog box and asks "Enter command number:"
paul.harrison@...and greg.ross@... and BrettK
Members paul.harrison, greg.ross, and BrettK tagged teamed to show us a tip that makes switching directories easier at the command prompt. For example, if you don't want to type or can't remember a long folder name, you can use a wild card or the tab key to speed things along.
At the C:\ prompt, type:
And the directory will change to:
C:\Documents and SettingsAlternatively, you can use the Tab key instead of the "*" wild card to get the Documents and Settings folder name (Figure C).
Hitting the Tab key after typing the first few letters of a long folder name will give you choices.
Member p.laman@... provided us a link to Microsoft TechNet, which explains many of the commands and parameters you can use with Doskey.
Members davids@..., jnickell@..., and particularly philrunninger@... teamed up to write a couple of batch files you can use to log your command-line sessions and then ask for specific information from that log.
Create these two batch files with your favorite text editor and place them in a folder that you can access from the command-line window. I used C:\.
echo ---------------- %date% %time% ---------------- >> "%userprofile%\cmdHistory.txt"
doskey /history >> "%userprofile%\cmdHistory.txt"
if %1. == . (
type "%userprofile%\cmdHistory.txt" 2> nul
echo ---------------- %date% %time% ----------------
) else (
if /i %1. == /edit. (
start "Revising History..." "%userprofile%\cmdHistory.txt"
) else (
echo ------------------------------------------- Previous Windows
type "%userprofile%\cmdHistory.txt" 2> nul | findstr /i "%*"
echo ------------------------------------------------ This Window
doskey /history | findstr /i "%*"
After taking care of business in the command-line window, type q.bat instead of typing exit. Now, you can type h.bat with a parameter that will show you the commands that match it. For example:
h.bat pingWill show you all the ping commands you issued (Figure D).
The h.bat file will show you the commands from your log that match the parameter.
Thanks to everyone who participated in the discussion thread stemming from last week's tip. The knowledge, expertise, and professionalism shown in that discussion are greatly appreciated. Never-seen-before tips are few and far between when it comes to Windows XP, but it can be well worth our time to refresh our collective memories about these hidden gems in the operating system.
For your efforts, every member mentioned in this blog post is due a piece of TechRepublic swag. Just send me a private message with your mailing address and I'll hook you up.
Do you have a favorite tip, or possibly an obscure one, that you'd like to share with your peers at TechRepublic? Add them to the discussion thread that follows this blog post or send me a private message explaining it so that I can recreate it.
Stay on top of the latest XP tips and tricks with TechRepublic's Windows XP newsletter, delivered every Thursday. Automatically sign up today!