WinSCP Scripting Problem - Need to execute from SHELL

I'm using WinSCP in the scripting mode with an MS Access 2K application.

My goal is to use the shell command that runs a batch file that ftp's a file.

THe MS Access application needs to know when the FTP has completed, so I use a batch file to copy a flag into the directory.
The Access Application then loops, checking every second to see with the flag exists, before it continues...

The problem is that while the batch file works as expected when executed from the command mode, it does not perform as expected when I use the Shell command.
I'm pretty sure the problem is the use of the term "exit" in the WinSCP script, but I don't know what to do to solve the problem.

Here is my batch file... StartFTP.bat (again... batch file creates Finished_FTP_Flag.txt as expected)

DEL "\\<myServer>\Database\XMIT-files\Finished_FTP_Flag.txt"
"C:\Program Files\WinSCP\" /ini=nul /command "open ftp://<myFTP_Site>/" "put \\<myServer>\database\xmit-files\<>" "exit"  
COPY "\\<myServer>\Database\DistiTools\FinishedConvertingFlag.txt" "\\<myServer>\Database\XMIT-files\Finished_FTP_Flag.txt"

Here is my MS Access (VBA) command (again... batch file never creates Finished_FTP_Flag.txt
 Call Shell("c:\<MyPath>\StartFTP.bat")

Any suggestions???
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gustav BrockCIOCommented:
You can do this much easier by using ShellAndWait - a simple technique that pauses the code while the Shell command is running:

Shell and Wait

The Shell function starts the command text and then immediately returns control back to the calling VBA code -- it does not wait for the command used in Shell to terminate. This page describes a function named ShellAndWait that will call the Shell function and then wait for the Shell'd process to terminate or for a prescribed timeout interval to expire.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.