Set the current Windows clipboard entry.
Syntax Set-Clipboard [-Append] [-AsHtml] [-Confirm] -LiteralPath String [-WhatIf] [CommonParameters] Set-Clipboard [-Append] [-AsHtml] [-Confirm] -Path String [-WhatIf] [CommonParameters] Set-Clipboard [-Value] String [-Append] [-AsHtml] [-Confirm] [-WhatIf] [CommonParameters] Key -Append Do not clear the clipboard but append content to it. -AsHtml Render the content as HTML to the clipboard. -LiteralPath String The path to the item that will be copied to the clipboard. Unlike Path , the value of LiteralPath is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell PowerShell not to interpret any characters as escape sequences. -Path String The path to the item that will be copied to the clipboard. Wildcard characters are permitted. -Value String Specify, as a string array, the content to copy to the clipboard. -Confirm Prompt for confirmation before running the cmdlet. -WhatIf Describe what would happen if you executed the command without actually executing it. CommonParameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable, -OutBuffer, -PipelineVariable -OutVariable.
Standard Aliases for Set-Clipboard: none, but if you want to add a short alias like clop, set it with set-alias
When using Set-Clipboard in a script you should warn the user that their clipboard is about to be overwritten.
Copy some text to the clipboard:
PS C:\> Set-Clipboard -Value "This is a test string"
Copy the contents of a directory to the clipboard:
PS C:\> Set-Clipboard -Path "C:\Staging\"
“A clipboard and a hard hat could get you just about anywhere” ~ Kim Harrison
Related PowerShell Commands:
Get-Clipboard - Get the current Windows clipboard entry.