Use clipboard from VBScript

Another solution I have found that isn’t perfect in my opinion, but doesn’t have the annoying security warnings is to use clip.exe from a w2k3 server.

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd.exe /c echo hello world | clip", 0, TRUE

Example with a multiline string as per question below :
Link1

Dim string
String = "text here" &chr(13)& "more text here"
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd.exe /c echo " & String & " | clip", 0, TRUE

Leave a Comment