Recall Commands In Windows With Command Prompt History

6

winlogo.jpgUsing the command line has many advantages if your a home user or System Administrator when it comes to quick execution or checking System information.

Many times you will find yourself using the same command multiple times.

Instead of constantly typing the same command over and over, Windows command history editor provides quick access to a list of recently executed commands.


There are several ways to recall a command from history either to execute the command again, edit it by adding addition arguments or changing to different directories. But first let's set the buffer that will determine the number of commands that can be stored.

To do this, click on Start \ Run… and type cmd for Wndows XP.

Or for Windows Vista and Windows 7, click Start and type cmd in the search box, then click cmd.exe in the search list.

When command shell window opens, click once on the command shell logo in the top left corner of the window and select properties.

Once the properties window opens, in the Command History section, you can leave the setting at their default values on change it to make the Buffer Size bigger (you can leave the Numbers of Buffers at 4).  Also check the Discard Old Duplicates. This will delete any duplicate commands in the history buffer. When finished click OK.

You may also want to check the Quick Edit Mode under Edit Options which will enable cut and paste at the command prompt.

After you have begun to use commands and you need to recall a command from history, one method is to press F7. This will open a window listing all the command, in order, you have used during the session.

To navigate and select a command, use the up / down arrow keys and press enter to select and immediately execute the command or use the left / right arrow keys to select a command which can be edited at the prompt. The Esc key closes the window without selecting a command.

If the history buffer has many commands, use the Pg Up / Pg Dn keys to jump ahead or back through the buffer.

Another method to recall from the history can be performed at the command prompt itself. Press either the up or down arrow keys, to scroll through the buffer or use Pg Up and move to the oldest command and Pg Dn moves to the newest command.

The F8 searches the buffer by first typing a few characters of the command and pressing F8. The most recent command to match the search will display. Repeatedly pressing F8 will continue the search for the next search match.

Using the F9 key will recall commands by their number. A popup window will appear allowing you to enter the number of the command previously executed.

You can also type the first letter of a command at the prompt, then use the right arrow key to continue to spell out the most recently used command. This is usefull if their were syntex errors that need to be edited.

Windows command prompt provides a powerful tool to manage your System. Knowing the tricks when using the shell makes Administration a lot easy and fun.

Know of any command prompt tricks? Tell us a trick or two and we'll we'll publish them with your name attached to them!

Filed under Windows Tips by  #

Comments on Recall Commands In Windows With Command Prompt History Leave a Comment

March 5, 2008

Fernando @ 1:39 pm #

June 13, 2008

murthy @ 5:38 am #

Comment on Recall Commands In Windows XP With Command Prompt history

November 23, 2008

Adrian Angelov @ 9:22 am #

Is there a way to preserve command history through sessions? I mean, open command prompt, execute command 'dir', close the prompt , open it again and using F7 to be able to see dir in the history browser.

Thanks

March 2, 2010

Adrian Angelov @ 11:35 am #

Thanks :)

February 21, 2011

Nifras @ 2:52 am #

Dear Buddy ,

when i am working in office normally i am using proxy web site.. and i am using to delete all history c cleaner software. but our IT gay he is finding all history by CMD way .. i want to know how to delete this all .. please tell me friends ….. or how to check history by CMD…
i waiting your replay please help me ……

Leave a Comment

Fields marked by an asterisk (*) are required.

Subscribe without commenting