How to Show/Execute History Command Lines in Windows Command Line Prompt?


At Linux BASH shell, we can type in history command to print a list of the commands that have been entered in the current shell. Combining with other commands (e.g. awk) with pipelines, we can do some statistics to show the most frequently typed commands, like the following two:

1
2
history | tr -s ' ' | cut -d ' ' -f3 | sort | uniq -c | sort -n | tail | perl -lane 'print $F[1], "\t", $F[0], " ", "▄" x ($F[0] / 12)'
history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl |  head -n10
history | tr -s ' ' | cut -d ' ' -f3 | sort | uniq -c | sort -n | tail | perl -lane 'print $F[1], "\t", $F[0], " ", "▄" x ($F[0] / 12)'
history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl |  head -n10

At windows command prompt, you can show a Graphical History window by pressing the F7 key.

show-history-with-F7-windows-command-prompt How to Show/Execute History Command Lines in Windows Command Line Prompt? windows batch windows command shell

show-history-with-F7-windows-command-prompt

As you can see, the commands that have been typed in in the current shell are listed, and you can navigate by using arrow keys (up, down) or the page up and page down. You can also press enter to repeat the command if you wish.

Alternatively, you can press F9 function key to enter the specific command you want to execute in the command history.

enter-command-number-F9-windows-command-prompt How to Show/Execute History Command Lines in Windows Command Line Prompt? windows batch windows command shell

enter-command-number-F9-windows-command-prompt

This is one of the nice awesome (but kinda forgotten) feature for Windows Command Line Prompt!

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
346 words
Last Post: How to Filter the Unique Email Addresses?
Next Post: Simple xargs Batch Implementation for Windows

The Permanent URL is: How to Show/Execute History Command Lines in Windows Command Line Prompt?

Leave a Reply