I'm using great PSReadLine module for Powershell and I really like that is persist my history of commands. But I need to reinstall my system. What is the easiest way to save this history (probably to file) an load it after fresh install of PSReadLine?
2 Get-History accesses the PowerShellhistory (current session only). PSReadLine uses its own history (in memory and saved in (Get-PSReadLineOption).HistorySavePath).
Here is a function I wrote to optimize the PSReadline history file. You can get the code from Github. The PSReadline module can maintain a persistent command-line history. However, there are no provisions for managing the file. When the file gets very large, performance starting PowerShell can be affected.
However, there are no provisions for managing the file. When the file gets very large, performance starting PowerShell can be affected. This command will trim the history file to a specified length as well as removing any duplicate entries. Set the maximum number of lines to store in the history file.
PSReadLine is a module created by Microsoft to customize the command line editing environment in PowerShell. It offers numerous customizations that can change how your command line editor presents data in many ways. Mike Kanakos is a Cloud and Datacenter Microsoft MVP, tech blogger and PowerShell community leader.
PSReadline
module save command history in file. All you need is to backup that file and restore it after reinstalling your system. You can get file name of history file by following command:
(Get-PSReadlineOption).HistorySavePath
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With