Created
July 6, 2021 06:41
-
-
Save diecknet/e2a9390f7cb1e4bbe8479d9c85dcd827 to your computer and use it in GitHub Desktop.
Copy last PowerShell command into clipboard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
I initially used this code: | |
history | Select-Object -Last 1 -ExpandProperty CommandLine | clip | |
But recently found this shorter version at https://powershellmagazine.com/post/2012-11-06-pstip-send-the-last-command-executed-to-clipboard/ | |
#> | |
(Get-History)[-1].commandline | clip | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment