Those Who Don’t Know Their History…
My function:\prompt changes every so often. For my latest, see
https://blogs.msdn.com/b/timid/archive/2014/02/07/prompts.aspx
... but one thing I have often used is the snippet
($([int]((Get-History | Select-Object -Last 1).ID) + 1))
This gives me the next history ID number (i.e. the ID for the line I’m about to type). This way, I can look at my screen and type
Invoke-History 15
However, amidst the armada of aliases PSH provides, I only find ‘history’. I’ve found that I use the invoke-history feature a lot more with both this play-by-play running ID for the command lines as I type them, and with the two trivial aliases
New-Alias -Name ihy -Value Invoke-History
New-Alias -Name ghy -Value Get-History
Comments
- Anonymous
February 21, 2014
I should note that I'm still living on some Server 2K3 machines, which are still running PSH2. PSH3 has the above aliases as ihy and ghy, respectively.