Quantcast
Channel: MSDN Blogs
Viewing all articles
Browse latest Browse all 5308

PowerShell PowerTip: History of commands with PSReadline

$
0
0

One of the really cool things PSReadline provides (module shipping on v5+) isn't as immediately obvious as the syntax highlighting. It offers a persistent history that is stored from session to session.

This means if you run commands in a window, close it, and open a new one later you can still hit the up arrow and scroll through them. I use this feature quite a bit doing demos or just working on things where I want to clear out my whole scope and jump back in.

If you want to opt out you can as well:


<span>Set-PSReadLineOption -</span><span class="highlight" id="0.6822782376879328" name="searchHitInReadingPane">History</span><span>SaveStyle </span><span>SaveAtExit #will only save the history once you close the window</span>

<span>Set-PSReadLineOption -</span><span class="highlight" id="0.6822782376879328" name="searchHitInReadingPane">History</span><span>SaveStyle SaveNothing #turns this off</span>


Hope that helps, tune in more often to get short and sweet PowerTips!


Viewing all articles
Browse latest Browse all 5308

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>