Monday, January 9, 2012

Reading the Clipboard using Powershell


PowerTip of the Day, from


What if you wanted to paste information from the clipboard? No sweat, here is a Get-Clipboard function that outputs any text held by the clipboard:

function Get-Clipboard {

 Add-Type -AssemblyName System.Windows.Forms

 $tb = New-Object System.Windows.Forms.TextBox

 $tb.Multiline = $true




In a previous tip we presented the corresponding Out-Clipboard function, so now you could send information to the clipboard in one PowerShell session and read it back from another.



1 comment:

  1. I have to say that you guys are doing excellent work. This post describes reading clipboard using powershell. The code given for performing this task is easy and simple. The logic behind the code is simple to understand.
    digital signatures