FTP Batch Files

I know you can create a FTP batch file that will connect to ftp site automatically.  My question is, can you include more than 1 batch file or sets of commands in the same .bat file.  I currently run 1.bat file to connect FTP, and copies the 2nd.bat file from ftp to local computer and runs. (Having a total of 2 batch files)

Can you create multiple batches in 1.bat file?
If not, how can I Call or run other batches after I connect to FTP within the same batch file?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

Steve KnightIT ConsultancyCommented:
Not quite sure what you are after, but I think you are saying you have, say,

1.cmd (or 1.bat) which uses FTP.exe to retrieve 2.cmd (or 2.bat).
Then you want 1.bat to pass control to the downloaded 2.bat.

There are four main ways if so:

1. Just add 1.bat to the next line of the batch, with the path to it if needed.  It will pass control to that other batch file and  NOT return to the first

2. Add CALL 2.bat with path if necessary.  It will pass control to the other batch and then return to the next statement in 1.bat

3. START 2.bat. It will run 2.bat in another window and at the same time carry on to the next statement.

4. START /WAIT 2.bat.  It will run 2.bat in another window and wait for it to finish then continue (similar to #2).

If this isn't what you want perhaps best to post your current script(s) to check.

Steve KnightIT ConsultancyCommented:
Some of the FTP methods for batch are here btw if you need more info:

then you would have somehing like:

@echo off
REM Script to retrieve 2.bat into c:\batch
ftp -s ftpscript.txt
cd /d c:\batch
call 2.bat
REM Carries on here after 2.bat finishes.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
POINTGREENAuthor Commented:
I accidentally deleted this question.  
Steve KnightIT ConsultancyCommented:
As to your other question ypu posted bu seems was deleted too, if you have an account on the remote machine and it is accessible via windows then you can uses psexec to run a program or batch file.
Other way depending upon the requirements is to have a batch constantly running on the remote machine which, say, does:

@Echo off
if exist c:\ftpdir\2.cmd START /WAIT c:\ftpdir\2.cmd
del c:\ftpdir\2.cmd
ping -n 61
goto start

i.e. loop around every 60 secs and run the batch file in the ftp space if it exists.
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
File Sharing Software

From novice to tech pro — start learning today.