0

I have a command line code with me.Can any one help to convert the line of code to vbs.The line of code must be executed under oshell.Run command.(wher oshell is the object of WScript.Shell)

The command line code is as follows

 c:\programfiles x(86)\winscp>winscp.com /command "option batch abort" "option confirm off" "open ftps://USERNAME:PASSWORD@FTPSITE.COM:PORTNUMBER/" "put C:\MyFolder\ForSFTP\TestFile.txt /savefile/" "exit"

Any help will be appreciated

Hareesh N
  • 121
  • 1
  • 6
  • Possible duplicate of [VBScript: How to call Run() with parameters](http://stackoverflow.com/questions/15025843/vbscript-how-to-call-run-with-parameters) – Helen Nov 02 '15 at 14:54

1 Answers1

3

Use CreateObject to create "WScript.Shell" object.

Use "" to escape " inside a string.

Use the help page to see other arguments of Shell.Run method.

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "c:\program files x(86)\winscp\winscp.com /command ""option batch abort"" ""option confirm off"" ""open ftps://USERNAME:PASSWORD@FTPSITE.COM:PORTNUMBER/"" ""put C:\MyFolder\ForSFTP\TestFile.txt /savefile/"" ""exit""", 1, True
Dmitry Sokolov
  • 3,118
  • 1
  • 30
  • 35