Share via


Set-Clipboard

Sets the current Windows clipboard entry.

Syntax

String (Default)

Set-Clipboard
    [-Append]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Value

Set-Clipboard
    [-Value] <String[]>
    [-Append]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Path

Set-Clipboard
    -Path <String[]>
    [-Append]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

LiteralPath

Set-Clipboard
    -LiteralPath <String[]>
    [-Append]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

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

Examples

Example 1: Copy text to the clipboard

Set-Clipboard -Value "This is a test string"

Example 2: Copy the contents of a directory to the clipboard

This command copies the content of the specified folder to the clipboard.

Set-Clipboard -Path "C:\Staging\"

Parameters

-Append

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

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

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:PSPath

Parameter sets

LiteralPath
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Path

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

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:True
DontShow:False

Parameter sets

Path
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Value

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

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Value
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

String