How to use telnet to run a vbs script to do something like "objshell.sendkeys" RRS feed

  • Question

  • For the perpose of auto test, I need to telnet to a remote windows and use vbs to drive the remote windows to do some action.

    The script is like follow:

    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.Run("""C:\\Program Files (x86)\\WinSCP\\WinSCP.exe""")
    'WScript.Sleep 1500 
    'WshShell.SendKeys "H"  


    When I run this script directly on the remote PC,it works all OK.

    But when I use telnet login on the remote PC and run the scrpit up there ,the script just can not work.

    Why and how should I do?

    • Moved by Bill_Stewart Friday, July 27, 2018 6:15 PM This is not "scripts on demand"
    Tuesday, April 24, 2018 3:20 AM

All replies

  • See this for how to script WinSCP: https://winscp.net/eng/docs/scripting

    Post questions in the WinSCP forum.  This is not a WinSCP forum.


    Tuesday, April 24, 2018 3:32 AM
  • The script above is just a example.

    Atually I need use vbs to run some programme such as ie,word and so on.

    And to put some word or action to them to see the result.

    Can I use the WshShell to get it?

    Tuesday, April 24, 2018 3:37 AM
  • VBScript cannot automate SCP successfully but it can run SCP with an SCP script.  Post in WinSCP forum to learn how.  This is NOT a WinSCP forum.

    SendKeys is not reliable for many reasons and is maintained fro backward compatibility.  New OS versions will not work correctly.


    Tuesday, April 24, 2018 3:40 AM