| 1. |
Solve : FTP Batch Script? |
|
Answer» I have batch script for simple FTP (import/export) with out any error handling. Singleton06, normaly, just use the command "pause" and it says: press any key to continue Perhaps this might help. @ECHO off rem ################################################################################ rem # Created by: Gustaaf Von Pickartz rem # Date: November 20th, 2005 rem # rem ################################################################################ set FTPUSER=username set FTPPWD=password set FTPDIR=C:\TEMP\FTP set ANYFILE=C:\DIR\FILE.ZIP echo open ftp.server.com > send.ftp echo user %FTPUSER% %FTPPWD% >> send.ftp echo binary >> send.ftp echo cd incoming >> send.ftp echo put %FTPDIR%\%ANYFILE% >> send.ftp echo bye >> send.ftp ftp -i -n -s:send.ftp del /f send.ftp exit what i was refering to as a pause is to literally put the word "pause" on a completely different line such as @echo off echo Hello How are you doing? pause ehco I'm good... pause end now, i spelled the word echo wrong on the second line and if you were to RUN through this as a batch file, it iwll tell you that "ehco is not an internal or external command" I will also have to hit a key to continue, so i will have time to watch what happens, and be able to tell that i have spelled the word wrong This is just a quick suggestion, which you may be able to tell what you did wrong by the exmaple provided above....Okay, I'm confussed about the thread now. did you want to know how to automate an FTP script or Errorcheck your batch files? You can can do error checking in a batch. Using Errorlevel as checking tool: COPY C:\TEMP\*.TMP D:\TEMP IF ERRORLEVEL 0 ECHO THE COPY WAS GOOD! IF ERRORLEVEL 1 ECHO ERROR IN COPY That is the basics of errorlevel checking. Valid numbers are 1-255. You can always errorcheck any application you have just started or network you connected to. You can Use the GOTO command instead of ECHO to make your batch jump to a particular section to further process the error example: RD /S RECYCLER >NUL IF ERRORLEVEL 1 goto :error ECHO The delete was okay. GOTO END :ERROR echo Warning, I was unable to delete! GOTO END :END echo BYE! may i know how to do the auto run? |
|