I tried to get a FTP script running but it stucks and I don't know why.
I have read this: http://www.dostips.com/DtTipsFtpBatchScript.php#Batch.FtpBatchUsingVariables
So I create a batch file like this:
Code: Select all
;@echo off
;(for /f "usebackq delims=" %%A in ("%~f0") do call echo.%%A)>"c:\temp\%~n0.ftp"
;ftp -i -s:"c:\temp\%~n0.ftp" filename
;GOTO:EOF
open ftpserver
username
password
cd directory1
binary
get filename
disconnect
bye
This batch creates a file FTP.ftp in the directory c:\temp
This ftp file looks good.
But when I run my batch it stucks.
In the DOS window I only see c:\temp\ftp.bat but nothing happens. When I interrupt the batch with crtl+c I can find the FTP.ftp file wich contains the right code but why stucks my batch?
Another question. How can I run the batch with a variable? I try to start it as ftp.bat filename and I replace the command get filename with get %1. But when i do this the FTP.ftp contains get -i, so this comes from the line:
;ftp -i -s:"c:\temp\%~n0.ftp"
How can I use variables wich will be included in the ftp batch?