O R G A N I C / F E R T I L I Z E R: PowerShell: Accessing the Clipboard

Sep 24, 2013

PowerShell: Accessing the Clipboard

Every time I do something in PowerShell, I find something else new to love. I’m pretty familiar with using “mycommand | clip” to send something directly to the clipboard. Found out that retrieving stuff from the clipboard is almost as easy:

> Write-Output "crap" | clip
> [System.Windows.Forms.Clipboard]::GetText()


UPDATE: Added the below statement because I run into this constantly when working with arrays. This splits your array on whitespaces.

$myVar -split '\s+'

Thank you to PowerShelladmin.com for this goodness on split operators.