What about an image? Use the Image format. See the last sample that copies the folder into the clipboard? You will need to use the FileDropList format to retrieve it from the clipboard. Since there are different types of contents being copied into the clipboard, we will need to use different format parameters to differentiate them. Now let’s see how to get the content out of the clipboard using the cmdlet Get-Clipboard. PS> Set-Clipboard -Path "h:\scripts" Get-Clipboard ![]() Or directly copy any of the items to the clipboard by specifying its path. PS> Set-Clipboard -Value "Sending a string of text to the clipboard" Other than piping the output to the cmdlet, you can also directly use the cmdlet to save a string to the clipboard. ![]() PS> $env:SystemRoot | Set-Clipboard -Append Since Set-Clipboard has an Append switch, you can add more content to the current clipboard without removing the previous ones. You can still pipe the output to send the result to the clipboard. The cmdlet Set-Clipboard is the replacement of clip.exe but behaves the same way and more. While the clip trick still works, there is a much better way with the help from two native PowerShell cmdlets, Set-Clipboard and Get-Clipboard. But how do we deal with the same thing in a PowerShell environment, such as send a result straight to the clipboard? I even use Win V a lot more since Windows 10 introduced the new clipboard history feature. We use copy/paste almost every day through many of the applications we use.
0 Comments
Leave a Reply. |