Recently I have been involved in some repetitive processes using PowerShell that revolved around calling previously dot sourced scripts and functions several times but in a way that did not lend itself to scripting.
Although I love the PowerShell F7 trick (have you tried it yet?) I wanted to get the session history into a text file for use and for posterity.
Getting session history is easy –
Getting session history as a list of issued command lines is also easy –
Get-History | Select -ExpandProperty commandline
PowerShell piping then lets us jab this to a file and then open the file in Notepad –
Get-History | Select -ExpandProperty commandline | Out-File cmd.txt ; notepad.exe cmd.txt
Throw in some alias and get a little economical with piping and we have ourselves a #powertweet !
Ghy | Select -exp commandline > cmd.txt ; notepad cmd.txt
The first rocking #powertweet !
more to follow…