Set-​Clipboard

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

Description

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

Examples

Example 1: Copy text to the clipboard

PS C:\> Set-Clipboard -Value "This is a test string"

This command copies a string to the clipboard.

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

Required Parameters

-LiteralPath

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.

Type:String[]
Aliases:PSPath
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Path

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

Type:String[]
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Value

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

Type:String[]
Position:0
Default value:None
Accept pipeline input:True (ByPropertyName, ByValue)
Accept wildcard characters:False

Optional Parameters

-Append

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

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-AsHtml

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

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

System.String[]