Hareesh N
Hareesh N

Reputation: 121

Convert command line code to vbs code

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:[email protected]:PORTNUMBER/" "put C:\MyFolder\ForSFTP\TestFile.txt /savefile/" "exit"

Any help will be appreciated

Upvotes: 0

Views: 878

Answers (1)

Dmitry Sokolov
Dmitry Sokolov

Reputation: 3180

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:[email protected]:PORTNUMBER/"" ""put C:\MyFolder\ForSFTP\TestFile.txt /savefile/"" ""exit""", 1, True

Upvotes: 3

Related Questions