>I have a .bat file that runs a script file to transfer a file to an sFTP.
>
>My problem is that the .bat file & script run pretty fast, and I don't want the rest of my VFP code that comes after this to run until the script/.bat file is finished.
>
>Right now I'm doing something like this:
>
>lcDosCommand = 'bhftp_ScriptRunner.bat'
>Run/N7 &lcDosCommand
>
>...and this is what's in the .bat file:
>
>winscp /console /script=bhFTP_Script.txt /log=wlog.txt
>
>if errorlevel 1 goto error
>echo Success
>Del failed.flg
>
>goto end
>
>:error
>echo Error!
>Del Success.flg
>
>:end
>
>
>...so I'm using the RUN /N7 command to try to do this. I *thought* the N7 switch would keep the dos window from appearing but it still flashes. Anyway surely there is a better approach to do this than what I've come up with thus far.... any suggestions anyone?
I believe there are several ways to achieve this.
One I know works for sure, including causing VFP to pause until the external command finishes is to use Ed Rauh's API_APPRUN class: Download#
9477You can also use the ShellExecute API function:
http://www.news2news.com/vfp/?group=91&function=138 but I don't know if that can wait for execution to finish.
When externally running a .BAT or .CMD you may need to specify the CMD shell like this:
Drive\Path\CMD.EXE /C Drive\Path\bhftp_ScriptRunner.bat
i.e. what you're actually running is CMD.EXE, and passing the name of your .BAT or .CMD as a parameter.
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up