Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

Leo

Re: run WinSCP from vbs

Hi Martin. Yes as a matter of fact I did try that. The problem is not with WinSCP, it's with how WSCRIPT will execute a batch file that in turns executes a program, which in turn takes its commands from a text file. The execution hierarchy is long in this case, and the Test file gets no priority, and there was no (easy) way to get the WinSCP script to open and execute the commands in the .txt file. However as I wrote above, I did find the solution, by directly running the WinSCP script from within the VBS file, and passing the commands through the /command switch. It works perfectly. Thanks for the help


Leo

martin wrote:

Leo wrote:

So I am trying to run a command on WinSCP from VBS, but it does not run. Is there a way to accomplish this?

wshShell.Run("WinSCP3.exe secureSFTP /console /script=fsftp.txt"),1,True

Have you tried to specify full path? Would it help?
martin

Re: run WinSCP from vbs

Leo wrote:

So I am trying to run a command on WinSCP from VBS, but it does not run. Is there a way to accomplish this?

wshShell.Run("WinSCP3.exe secureSFTP /console /script=fsftp.txt"),1,True

Have you tried to specify full path? Would it help?
Leo

Re: run WinSCP from vbs

never mind. got it

if anyone will benefit from this (and doesn't know how to), here's what I did

From VBS, it seems impossible to run an WinSCP script that resides in a txt file. Therefore this will not work:

Dim wshShell
Set wshShell = WScript.CreateObject("WScript.Shell")
wshShell.Run("WinSCP3.exe secureSFTP /console /script=fsftp.txt"),1,True

Putting the above code in a bat file and trying to execute the bat file from VBS had the same issue. I tried several techniques but none worked, until this

Dim wshShell
Dim sftpcmd
Set wshShell = WScript.CreateObject("WScript.Shell")
sftpcmd = "WinSCP3 secureSFTP /console /command " & """option batch on""" & " " & """option confirm off""" & " " & """cd /Dex""" & " " & """option transfer binary""" & " " & """get securefile.txt.pgp C:\\SecureFileDump\\Archive\\""" & " " & """close""" & " " & """exit"""

wshShell.Run(sftpcmd),1,true

wscript.sleep(10000) 'wait for 10 seconds until sftp is done

Maybe this is not a big thing, but I thought I'd put it up here for someone's benefit


Thanks
Leo

Leo wrote:

So I am trying to run a command on WinSCP from VBS, but it does not run. Is there a way to accomplish this?





see, when it tries to run the txt file, it closes. Is there a way to make it wait? How can I do this?

Thanks
Leo
Leo

run WinSCP from vbs

So I am trying to run a command on WinSCP from VBS, but it does not run. Is there a way to accomplish this?

wshShell.Run("WinSCP3.exe secureSFTP /console /script=fsftp.txt"),1,True

see, when it tries to run the txt file, it closes. Is there a way to make it wait? How can I do this?

Thanks
Leo