PoshCode Archive  Artifact [fa6944a3fa]

Artifact fa6944a3fa594b937c1dde7d18f56adc3d041e5f82e62329084985b7eba22196:

  • File Get-Clipboard.ps1 — part of check-in [6431f24a16] at 2018-06-10 13:46:54 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: 4856
# x-archived: 2016-03-18T21:24:29
# x-published: 2016-01-30T16:49: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()
}