Powershell now handily remembers history from previous sessions, and I can get to earlier commands simply by using the up-arrow. What I would like though is to be able to display this history, but I can't figure out how to do it.
The command get-history for some reason only seems to be able to display the history for the current session. Even passing the -count option doesn't help.
At the moment the only way I can get to a previous command is to manually up-click through all previous commands to find the one I'm looking for. This obviously can be quite tedious if the command was run a while ago.
Is there some trick to make get-history work correctly, across sessions. This list is obviously stored somewhere, so it aught to be possible to display it.
edit: This isn't a duplicate question. This is about accessing the full history which is already recorded by Powershell, not about adding a new (custom) way to save session history. Those other questions and associated answers were relevant before Powershell had the ability to automatically record full command history.
PSReadline
module, the history is written to a text file and preserved between sessions. (PSReadline
is baked in on Windows 10.)%userprofile%\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt