Skip to content

Instantly share code, notes, and snippets.

@webtroter
Created July 27, 2022 14:28
Show Gist options
  • Save webtroter/b621021cc5c70413eb80ba947e976778 to your computer and use it in GitHub Desktop.
Save webtroter/b621021cc5c70413eb80ba947e976778 to your computer and use it in GitHub Desktop.
Invoke-TypeClipboard - Types your clipboard
<#
.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