Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Listing the Current Windows PowerShell History
During each session Windows PowerShell keeps track of all the commands you type in the console window. Retrieving a list of those commands is as easy as calling the Get-History cmdlet:
Get-History
By default Windows PowerShell keeps track of the most recent 64 commands typed in the console window; when you invoke the Get-History cmdlet only the 32 most recent of those commands are displayed (e.g., commands 33 through 64). So how do you view commands 1 through 32? In that case you tell Get-History to start with command 32 and count backwards (using the -count parameter) 32 times. Don’t worry; that sounds more complicated than it really is:
Get-History 32 -count 32
Incidentally, for any given Windows PowerShell session you can change the number of commands that Windows PowerShell keeps track of; that can be done by modifying the $MaximumHistoryCount variable. For example, would you prefer that Windows PowerShell keep track of your last 150 commands? Okey-doke:
$MaximumHistoryCount = 150
Get-History Aliases |
---|
|