The Windows GUI may be easy for the average user to navigate, but power users and IT pros alike still recognize the usefulness of the command prompt. Bill Detwiler shows you five tricks that will help you become a command-prompt ninja.
In the video, I mention a tip from TechRepublic member Kiwi.Dusty and mytmous about using the Function keys from the command prompt. Here’s the complete list Function Key actions as posted in the original article’s discussion post:
F1 retypes the previous command one character at a time
F2 brings up a dialog and asks “Enter the char to copy up to:”
F3 retypes the last command in full
F4 brings up a dialog and asks “Enter char to delete up to:”
F5 as for F3
F6 Print EOF character (Ctrl+Z)
F7 brings up a dialog of all the recent command history
F8 brings up each of the most recent commands, one at a time
F9 brings up a dialog and asks “Enter command number:”
I also outline a tip from members Davids, jnickell and philrunninger. These individuals wrote a couple of batch files that let you log your command-line sessions and then query that log for specific information.
Here’s the text for each file:
Filename: q.bat
@echo offecho ---------------- %date% %time% ---------------- >> "%userprofile%\cmdHistory.txt"
doskey /history >> "%userprofile%\cmdHistory.txt"
exit
Filename: h.bat
@echo offif %1. == . (
type "%userprofile%\cmdHistory.txt" 2> nul
echo ---------------- %date% %time% ----------------
doskey /history
) 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 "%*"
)
)
Here’s a big “thank you” to all the members who shared these great command line tips. I’ll be sending each of them a TechRepublic coffee mug.
For those of you who prefer text to video, you can click the Transcript link that appears below the video player window or you can also read Greg Shultz’s article, “Five Windows command-prompt tips every IT pro should know,” on which the first command line tip is based.
You can also sign up to receive the latest TR Dojo lessons through one or more of the following methods: