POINTGREEN
asked on
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?
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?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I accidentally deleted this question.
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
:start
if exist c:\ftpdir\2.cmd START /WAIT c:\ftpdir\2.cmd
del c:\ftpdir\2.cmd
ping 127.0.0.1 -n 61
goto start
i.e. loop around every 60 secs and run the batch file in the ftp space if it exists.
Other way depending upon the requirements is to have a batch constantly running on the remote machine which, say, does:
@Echo off
:start
if exist c:\ftpdir\2.cmd START /WAIT c:\ftpdir\2.cmd
del c:\ftpdir\2.cmd
ping 127.0.0.1 -n 61
goto start
i.e. loop around every 60 secs and run the batch file in the ftp space if it exists.
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