Set-Clipboard
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>]
The Set-Clipboard cmdlet sets the current Windows clipboard entry.
Parameters
-Append [<SwitchParameter>]
- Default value is False
- Accepts pipeline input False
Indicates that the cmdlet does not clear the clipboard and appends content to it.
-AsHtml [<SwitchParameter>]
- Default value is False
- Accepts pipeline input False
Indicates that the cmdlet renders the content as HTML to the clipboard.
-Confirm [<SwitchParameter>]
- Default value is False
- Accepts pipeline input False
Prompts you for confirmation before running the cmdlet.
-LiteralPath <String[]>
- This value is required
- Default value is None
- Accepts pipeline input ByPropertyName
Specifies the path to the item that is 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 Windows PowerShell not to interpret any characters as escape sequences.
-Path <String[]>
- This value is required
- Default value is None
- Accepts pipeline input ByPropertyName
Specifies the path to the item that is copied to the clipboard. Wildcard characters are permitted.
-Value <String[]>
- This value is required
- Default value is None
- Accepts pipeline input ByPropertyName
Specifies, as a string array, the content to copy to the clipboard.
-WhatIf [<SwitchParameter>]
- Default value is False
- Accepts pipeline input False
Shows what would happen if the cmdlet runs. The cmdlet is not run.
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,ErrorAction, ErrorVariable, WarningAction, WarningVariable,OutBuffer, PipelineVariable, and OutVariable.
Inputs
System.String[]Examples
-
Copy text to the clipboard:
PS C:\> Set-Clipboard -Value "This is a test string"
This command copies a string to the clipboard.
-
Copy the contents of a directory to the clipboard:
PS C:\> Set-Clipboard -Path "C:\Staging\"
This command copies the content of the specified folder to the clipboard.
Additional Notes
This work is licensed under a Creative Commons Attribution 4.0 International. It is attributed to Microsoft Corporation and can be found here.
PowerShell Commands