PoshCode Archive  Artifact [512b9c02ce]

Artifact 512b9c02ce94188c0ac0a02cc178650059c54ff4277e964b462fcfbefd3c64fc:

  • File Get-Clipboard.ps1 — part of check-in [79c9a1e12b] at 2018-06-10 13:05:56 on branch trunk — From Windows PowerShell Cookbook (O’Reilly) by Lee Holmes (user: Lee Holmes size: 866)

# encoding: ascii
# api: powershell
# title: Get-Clipboard.ps1
# description: From Windows PowerShell Cookbook (O’Reilly) by Lee Holmes
# version: 0.1
# author: Lee Holmes
# license: CC0
# x-poshcode-id: 2150
# x-archived: 2017-05-22T03:11:33
# x-published: 2011-09-09T21:40:00
#
#
#############################################################################
##
## Get-Clipboard
##
## From Windows PowerShell Cookbook (O'Reilly)
## by Lee Holmes (http://www.leeholmes.com/guide)
##
##############################################################################

<#

.SYNOPSIS

Retrieve the text contents of the Windows Clipboard.

.EXAMPLE

PS >Get-Clipboard
Hello World

#>

Set-StrictMode -Version Latest

PowerShell -NoProfile -STA -Command {
    Add-Type -Assembly PresentationCore
    [Windows.Clipboard]::GetText()
}