I recently switched to powershell since my Cygwin bash started giving me senseless compilation errors when using maven. I've found how to save and restore my command history in (https://stackoverflow.com/questions/9259723/is-there-a-windows-shell-tool-can-keep-history), which seems to work (using "History" will show the recent commands after a clean start).
What I can't seem to do is access this history with the up arrow like you would if the command was used in the current session.
Any ideas?
Like say @jhclark it is now possible
You have all the documentation for installation in the official GitHub : https://github.com/PowerShell/PSReadLine
You will have to follow the whole tutorial well and pay attention to:
-AllowPrerelease
arg if you have errorImport-Module 'PSReadLine'
in your profile code $PROFILE
for example to open your profile conf with vscodePSReadLine
if you want all work fineLaunch this two lines if you want the fleche to search in the history like on Linux because that is, I think, what most people are looking for:
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
by default are the key combinations F8
and SHIFT + F8
which are configured by default
You can see the conf with that :
Get-PSReadLineKeyHandler
As of October 2013, this is now possible using the wonderful PSReadline module: http://github.com/lzybkr/PSReadLine
You'll still need to save your history when your powershell session exits and load it in your profile.ps1 prior to loading PSReadline (see http://technet.microsoft.com/en-us/library/ee156792.aspx). You can register a hook to save your history when PowerShell exists using a hook like this: Powershell profile "on exit" event?. Unlike vanilla PowerShell, PSReadLine allows the up/down keys to access this history buffer.
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