Set-Clipboard

Sets the current Windows clipboard entry.
Set-Clipboard [-Append] [-AsHtml] [-Confirm] [-WhatIf] [<CommonParameters>]
Set-Clipboard [-Value*] <String[]> [-Append] [-AsHtml] [-Confirm] [-WhatIf] [<CommonParameters>]
Set-Clipboard [-Append] [-AsHtml] -Path* <String[]> [-Confirm] [-WhatIf] [<CommonParameters>]
Set-Clipboard [-Append] [-AsHtml] -LiteralPath* <String[]> [-Confirm] [-WhatIf] [<CommonParameters>]

The Set-Clipboard cmdlet sets the current Windows clipboard entry.

Parameters
-Append [<SwitchParameter>]

Indicates that the cmdlet does not clear the clipboard and appends content to it.

-AsHtml [<SwitchParameter>]

Indicates that the cmdlet renders the content as HTML to the clipboard.

-LiteralPath <String[]>

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[]>

Specifies the path to the item that is copied to the clipboard. Wildcard characters are permitted.

-Value <String[]>

  • This value is required
  • Accepts pipeline input ByValue

Specifies, as a string array, the content to copy to the clipboard.

-Confirm [<SwitchParameter>]

  • Default value is false

Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.

-WhatIf [<SwitchParameter>]

  • Default value is false

Shows what would happen if the cmdlet runs. The cmdlet is not run.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
  1. Copy text to the clipboard:
    PS C:> Set-Clipboard -Value "This is a test string"
    

    This command copies a string to the clipboard.

  2. 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.

Related Links

Get-Clipboard