Created
July 27, 2022 14:28
-
-
Save webtroter/b621021cc5c70413eb80ba947e976778 to your computer and use it in GitHub Desktop.
Invoke-TypeClipboard - Types your clipboard
This file contains hidden or 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
<# | |
.SYNOPSIS | |
This will type the clipboard | |
.DESCRIPTION | |
This command will type the clipboard after a configurable delay, set at 2 seconds by default | |
.PARAMETER SecondsToSleep | |
Seconds to sleep before sending the clipboard | |
.EXAMPLE | |
PS> Invoke-TypeClipboard | |
#> | |
function Invoke-TypeClipboard { | |
[CmdletBinding()] | |
param ( | |
# Sleep for X Seconds, defaults to 2 seconds | |
[Parameter()] | |
[int] | |
$SecondsToSleep = 2 | |
) | |
begin { | |
$wshell = New-Object -ComObject wscript.shell | |
} | |
process { | |
$wshell.SendKeys( $(Get-Clipboard) ) | |
} | |
end { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment