TechRepublic : A ZDNet Tech Community

TR Dojo

by Bill Detwiler, Head Technology Editor
Contact

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 off
echo ---------------- %date% %time% ---------------- >> "%userprofile%\cmdHistory.txt"
doskey /history >> "%userprofile%\cmdHistory.txt"
exit

Filename: h.bat

@echo off
if %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.

How often do you use the Windows command prompt?

Loading ... Loading ...

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:

Bill DetwilerBill Detwiler is Head Technology Editor of TechRepublic. Previously, he worked as a Support Tech and IT Manager in the social research and energy industries. Read his full bio and profile. You can also follow him on Twitter.

Print/View all Posts Comments on this blog

Do you still use the Windows command prompt? Bill Detwiler - TechRepublicTechrepublic Moderator | 08/31/09
Change size of cmd console window richard@... | 08/31/09
Nice one Bill Detwiler - TechRepublicTechrepublic Moderator | 08/31/09
...and add a little color! MvD@... | 09/01/09
I always max the size of the screen buffer height simon.rowe@... | 09/01/09
...and add a little color! bitdoctor | 09/01/09
Back to default terryd64@... | 09/01/09
green monochrome tiger@... | 02/04/10
You can also change the BUFFER size this way herbm_techrepublic@... | 09/01/09
de rigeur seanferd | 09/02/09
Good One dinesh@... | 09/01/09
Change size of cmd console window bitdoctor | 09/01/09
SERIOUS (= IT Ninja) cmd configuration ekw@... | 09/01/09
SERIOUS (= IT Ninja) cmd configuration bitdoctor | 09/02/09
Quick way to cmd bphillip@... | 09/02/09
I can tell how good an Admin is by how MANY cmd prompts he/she keeps open herbm_techrepublic@... | 09/01/09
Long time doskey user boyd.hawkins@... | 09/01/09
Vernon D. Buerg's 'LIST' 1983-95 dsimp@... | 09/01/09
I will save you one keystroke from dir /ad bitdoctor | 09/03/09
Sorry but your dir *. 'tip' is just wrong... herbm_techrepublic@... | 09/03/09
My tip is not 'wrong' - just not equivalent to yours bitdoctor | 09/04/09
Very nice stuartc@... | 09/01/09
Getting (to) the Command Prompt herbm_techrepublic@... | 09/01/09
Start here power toy griggs@... | 09/01/09
CMD Prompt Here tiger@... | 02/04/10
How can you not? brian.dower@... | 09/01/09
Command prompt and Explorer gapimlat@... | 09/01/09
DOH! youzer | 09/01/09
dragging to a CD Baruch Atta | 09/02/09
You can change drive using 'cd' simon.rowe@... | 09/03/09
Command prompt from Explorer amabilis@... | 09/01/09
Drag command or file complete with path from Explorer techrepublic@... | 09/03/09
Drag & Drop youzer | 09/01/09
I like it! stuartmacdonald@... | 09/04/09
Time Saver IndianaTux | 09/01/09
Nice tip, but I type the keystrokes in my sleep... TechRepublic@... | 09/01/09
Thanks Tonie16 | 09/01/09
Easy Batch Files don.howard@... | 09/01/09
Lazy links husserl@... | 09/01/09
Cygwin to use bash shell michael.kokot@... | 09/01/09
Cygwin to use bash shell-Thanks mukababi@... | 09/01/09
I have no DOSKEY :( pdm_pdq@... | 09/01/09
Faster and not subject to WTF richard@... | 09/01/09
Faster and not subject to WTF bitdoctor | 09/02/09
to redirect output to text file JasonKB | 09/01/09
Redirect BOTH output and ERROR Out herbm_techrepublic@... | 09/02/09
Redirect BOTH output and ERROR Out bphillip@... | 09/02/09
You don't need the first "1" (it is implied) bitdoctor | 09/03/09
Another Ping to text option bphillip@... | 09/02/09
Not bad, but doesn't seem to do much - MS needs a change bitdoctor | 10/29/09
It makes it easy to see if any devices fail bphillip@... | 10/30/09
Modular version of bat file bphillip@... | 10/30/09
Good, but.........Seems people are missing the point. mborges@... | 09/02/09
No, for many tasks it is much faster to type them at the command prompt herbm_techrepublic@... | 09/03/09
Superb follow-up comments - thanks! Drive Mapping?? bitdoctor | 09/04/09
Supported Windows versions joness59 | 09/02/09
h ping command, required file tiger@... | 02/04/10
Run a list of commands as cmd.exe starts mixty | 09/03/09
Command Prompt Portable mixty | 09/05/09
Don't forget ARGUMENT ZERO! %0% bitdoctor | 09/03/09
Argument %0 rume@... | 09/06/09
Arg 0 - yes %0 and, sometimes %0% bitdoctor | 09/13/09
How do we do %0% in batch? Interactive works OK bitdoctor | 10/29/09
How do you define batch ? rume@... | 10/29/09
No - "batch" is a job run via 'scheduler' bitdoctor | 10/30/09
Serial Number Locator brian.creno@... | 10/30/09
works on XP SP3 bphillip@... | 10/30/09
%0 works within job execution (scheduled batch file) as well rume@... | 10/31/09
Thanks! That lets me know it's an 'environment' issue bitdoctor | 11/01/09
Good stuff dennisbagenstos@... | 09/03/09
another command prompt tip sil_devil@... | 09/07/09
Ahhh, here's one not posted yet... jonj@... | 09/12/09
Stop a command that it running in the command window rh_77 | 09/30/09
RE: Five Windows command-prompt tips every IT pro should know Subhash_rash@... | 09/01/09
RE: Five Windows command-prompt tips every IT pro should know wael_jabari@... | 09/01/09
RE: Five Windows command-prompt tips every IT pro should know pholyoak@... | 09/01/09
Because the article left out an important feature of F8 herbm_techrepublic@... | 09/01/09
F2 is useful bphillip@... | 09/01/09
F4 in WinXP Pro doesn't work bphillip@... | 09/01/09
Works on both for me mudpuppy1 | 09/01/09
Works on both for me bphillip@... | 09/02/09
Now those are good examples... herbm_techrepublic@... | 09/02/09
Is there a cmd similar to the unix/linux; !$ ? mdwright@... | 09/01/09
RE: Five Windows command-prompt tips every IT pro should know ceji@... | 09/01/09
Here's some more MrFlimflam | 09/01/09
Great tip whether one uses these, UnxUtils, or BOTH! herbm_techrepublic@... | 09/01/09
The BerkUtils link is crapping out... rfolden@... | 09/01/09
There is also GNUWin32 fmcgowan | 10/28/09
RE: Five Windows command-prompt tips every IT pro should know murihwengg@... | 09/01/09
Where is the PDF download link for this transcript? vucliriel@... | 09/01/09
Barge out tonycopp@... | 09/01/09
RE: Five Windows command-prompt tips every IT pro should know Mandanae | 09/01/09
RE: Five Windows command-prompt tips every IT pro should know dr.s.raghunathan@... | 09/01/09
Powershell, Win7 and Win2k8R2 wfairley@... | 09/01/09
Powershell appears to be positioned to become the new command prompt enviro kapptaink@... | 09/01/09
Powershell pop quiz Bill Detwiler - TechRepublicTechrepublic Moderator | 09/01/09
Powershell is too obscure, too late -- maybe herbm_techrepublic@... | 09/02/09
Daily csmith.kaze | 09/01/09
...dont forget the shortcut Gadz00ks | 09/01/09
super r cmd enter csmith.kaze | 09/01/09
How do you get to the  | 09/01/09
To a specific location say "C:" peter.j.boyles@... | 09/01/09
open cmd prompt where you want bphillip@... | 09/01/09
Easy way afbell8@... | 09/01/09
F7 philip.kelley@... | 09/01/09
Agreed - F7 is nice, but UP-ARROW for last command! bitdoctor | 09/01/09
Agreed - F7 is nice, but UP-ARROW for last command! bitdoctor | 09/02/09
RE: Five Windows command-prompt tips every IT pro should know e.wordsworth@... | 09/01/09
RE: Five Windows command-prompt tips every IT pro should know pdm_pdq@... | 09/01/09
Doskey is built into all recent (and not so recent) Windows versions herbm_techrepublic@... | 09/02/09
Not in my XP pdm_pdq@... | 09/03/09
Nope. It wouldn't be Datacommguy | 09/03/09
It's in the System32 directory on XP, Server, and Vista herbm_techrepublic@... | 09/03/09
Thank You! pdm_pdq@... | 09/04/09
RE: Five Windows command-prompt tips every IT pro should know bjulias@... | 09/01/09
Thanx for the memories pandppc@... | 02/03/10
RE: Five Windows command-prompt tips every IT pro should know mukababi@... | 09/01/09
RE: Five Windows command-prompt tips every IT pro should know kylehedspeth | 09/01/09
RE: Five Windows command-prompt tips every IT pro should know hfaulkner@... | 09/01/09
RE: Five Windows command-prompt tips every IT pro should know emmet.jones@... | 09/01/09
Also teebes2004 | 09/01/09
RE: Five Windows command-prompt tips every IT pro should know ITGirl.2010 | 09/01/09
Always good reisen55@... | 09/01/09
RE: Five Windows command-prompt tips every IT pro should know maurice.c.boley@... | 09/01/09
Batch files afbell8@... | 09/01/09
Batch Files to Compile brian.creno@... | 09/01/09
Batch Files to Compile afbell8@... | 09/02/09
BAT vs CMD REMAC | 09/02/09
correct sjnelson@... | 09/03/09
An interesting rpoperty of CMD fmcgowan | 10/28/09
RE: Five Windows command-prompt tips every IT pro should know adamzski | 09/01/09
RE: Five Windows command-prompt tips every IT pro should know colonel_angel2004@... | 09/01/09
RE: Five Windows command-prompt tips every IT pro should know joe.mariadassou@... | 09/02/09
RE: Five Windows command-prompt tips every IT pro should know hiteshthappa | 09/02/09
RE: Five Windows command-prompt tips every IT pro should know roger3mi@... | 09/02/09
I can save you a keystroke on your "Notepad" tip bitdoctor | 09/03/09
Actually my 'notepad' has Ctrl-Alt-N as it's shortcut key herbm_techrepublic@... | 09/03/09
Yuck - ctrl-alt-ANYTHING is painful bitdoctor | 09/04/09
RE: Five Windows command-prompt tips every IT pro should know omagic@... | 09/02/09
RE: Five Windows command-prompt tips every IT pro should know burbachj@... | 09/02/09
RE: Five Windows command-prompt tips every IT pro should know stephen.edie@... | 09/03/09
RE: Five Windows command-prompt tips every IT pro should know matthew.savige@... | 09/03/09
RE: Five Windows command-prompt tips every IT pro should know saint@... | 09/04/09
Very useful canddsol@... | 09/04/09
RE: Five Windows command-prompt tips every IT pro should know paul.gurusinghe@... | 09/05/09
RE: Five Windows command-prompt tips every IT pro should know i.hashem | 09/27/09
RE: Five Windows command-prompt tips every IT pro should know harry_@... | 11/03/09
RE: Five Windows command-prompt tips every IT pro should know thyuoo | 12/29/09
RE: Five Windows command-prompt tips every IT pro should know The Truth | 02/03/10
So do you have a problem with helping a few noobs???? hground | 02/04/10

What do you think?

White Papers, Webcasts, and Downloads

Recent Entries

TR on Twitter

Archives

TechRepublic Blogs



IT Help Desk Survival Guide, Third Edition
TechRepublic's IT Help Desk Survival Guide, Third Edition provides tools and recommendations to help you better manage help desk services, improve end-user support, troubleshoot frustrating hardware issues, identify quick fixes to vexing Windows problems, and help users make the most of Microsoft Office 2003.
Buy Now
IT Professional's Guide to Policies and Procedures, Third Ed
Whether you're creating policies for management, training, personnel, support, privacy, Internet/e-mail usage, security, or inventory, you'll meet the needs of your entire enterprise with this one download!
Buy Now

SmartPlanet

Click Here