Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Powershell PSReadLine History

Tags:

powershell

I'm confused about how PSReadLine history works across sessions in Powershell. I can see in PS version 5.1 my previous command history is automatically stored in

%userprofile%\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\

However, if I run get-history I only see my current session command history. I thought hooks to save command history across sessions was no longer needed in later versions of Powershell. What am I missing?

like image 576
Chad Miller Avatar asked Oct 21 '25 08:10

Chad Miller


1 Answers

The file

%userprofile%\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt

containing only the entered commands (here ATM 22k lines),

and the current sessions history

Get-History | Format-List -Property *

Id                 : 88
CommandLine        : get-help Get-History -online
ExecutionStatus    : Completed
StartExecutionTime : 2018-12-14 16:16:49
EndExecutionTime   : 2018-12-14 16:16:49

are quite different things.