How To Export PowerShell Command History

Lately, I’ve been using PowerShell as the default shell for my daily tasks. I noticed PowerShell out of the box keeps track of all your previous history up to the maximum of 32767 lines. Meaning if you ever need to look back on what you’ve typed into the shell, it remembers almost all of them.

This becomes handy if you are looking for commands you were running a while ago but don’t want to keep scroll back and miss the moment. Or you have a particular command you were looking for.

Read More

If by pressing the up keys you can see your history, there must be a way to export all your PowerShell history if that’s the case. Thankfully, there is a quick way. you can ask power shell to print out where the history is saved.

❯ (Get-PSReadlineOption).HistorySavePath
2020 11 30 21 57 59 ConsoleHost history.txt Notepad 600x506 2

On my machine, this is the path it yields.

C:UsersJonathanAppDataRoamingMicrosoftWindowsPowerShellPSReadLineConsoleHost_history.txt

With any luck, you should have a list of the full history of your previous PowerShell commands. Here I was able to locate a few months ago command that I used to unlock and reimage my android for a custom ROM.

The post How To Export PowerShell Command History appeared first on Next of Windows.

Related posts