Copying Command History…

by Aug 19, 2014

All PowerShell Versions

If you played with PowerShell and suddenly realize that you would actually like to keep the commands you played with, try this simple one-liner:

(Get-History).CommandLine | clip 

It copies all commands from your command history to the clipboard. From there, you can paste all commands into your editor of choice, and save the commands to file.

If you paste the commands into the PowerShell ISE editor, your commands will turn into a PowerShell script.

Twitter This Tip! ReTweet this Tip!