Use clipboard from VBScript

后端 未结 15 1451
青春惊慌失措
青春惊慌失措 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:08

    Here's another version of using the "clip" command, which avoids adding a carriage return, line feed to the end of the string:

    strA= "some character string"
    

    Set objShell = WScript.CreateObject("WScript.Shell")
    objShell.Run "cmd /C echo . | set /p x=" & strA & "| c:\clip.exe", 2
    

    s = "String: """ & strA & """ is on the clipboard."
    Wscript.Echo s
    

    I've only tested this in XP. clip.exe was downloaded from Link and placed in C:\.

提交回复
热议问题