Secret history shortcut

by May 12, 2011

PowerShell will keep a history of the commands you entered and then you can list the history with Get-History, configuring the maximum length of that history with $MaxHistoryCount. This will tell PowerShell to keep the last 1,000 command lines in your history buffer:

$MaxHistoryCount = 1000


If you need to quickly find a particular command in your command history, you can enter #, keyword, and then press tab. PowerShell will now autocomplete against your history list. Try this line:



Each time you press tab, tab completion will suggest a new line from your command history that contains the keyword "dir."



Twitter This Tip!
ReTweet this Tip!