I’m a big fan of TextExpander which is sadly MAC / OSX only. A pretty cool free alternative (but not yet quite as good, at least in the free version) is called PhraseExpress. Making use of a clipboard history is really helpful, especially if you copy and paste a lot and don’t want to spend a lot of time, pressing UP UP UP UP UP just to eventually execute the wrong line.

PowerShell has it’s own version:

Get-History | Select-Object -ExpandProperty commandline | clip.exe

To copy only the last five commands, simply add the -Count parameter to Get-History:

(Get-History -Count 5).CommandLine | clip.exe


Pretty cool huh? Now that is pretty long. Another way you can do this is like so:

Get-History | ogv

And you can get it even shorter by using the alias:

h | ogv

This is handy because you can search using the gridview search functionality and then copy one or more commands by simply highlighted the ones you want and hitting Ctrl-C.

If you are only doing this to find a command to re-execute, v3 and later this is handy:

h | ogv -p | r