Use clipboard from VBScript

后端 未结 15 1474
青春惊慌失措
青春惊慌失措 2020-11-29 06:36

I am looking for a method to place some text onto the clipboard with VBScript. The VBScript in question will be deployed as part of our login script. I would like to avoid

15条回答
  •  一个人的身影
    2020-11-29 07:24

    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
    

提交回复
热议问题