The Get-History
command in PowerShell lists only the commands entered during the current session.
To get the list of all previously executed commands it is required to locate the file where these commands are stored.
In this note i will show how to locate the history file and list all commands executed previously in PowerShell.
Cool Tip: Clear history of previous commands in PowerShell! Read more →
Command History in PowerShell
Get the PowerShell command history file location:
PS C:\> (Get-PSReadlineOption).HistorySavePath
List the history of all commands executed previously in PowerShell:
PS C:\> cat (Get-PSReadlineOption).HistorySavePath