Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Copy last PowerShell command into clipboard
I initially used this code:
history | Select-Object -Last 1 -ExpandProperty CommandLine | clip
But recently found this shorter version at
(Get-History)[-1].commandline | clip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment