Even though there are several ways to accomplish sending files to an FTP site via scripted DOS commands, we at roguehelpdesk.com generally recommend going with an official how-to from the source which is Microsoft in this case. Microsoft recommends using 2 files. The first one is a text file that holds the FTP information and the other is the DOS/BATCH script that runs the FTP command. So once you run your FTP script, it will run the FTP command and process the FTP information file “test.src”.

EXAMPLE from http://support.microsoft.com/kb/96269

1st file = test.scr
open 11.11.11.11
username
password
put file1
quit

2nd file = sendftp.bat (you can name it whatever you want)
ftp -s:test.scr

Here’s another way to accomplish this with only one file. The only caveat is that the FTP information, including the username and password are within that one DOS/batch script.

@ECHO OFF
REM Generate FTP info for temp.txt
echo open ftp.domain.com> temp.txt
echo username>> temp.txt
echo password>> temp.txt
echo binary>> temp.txt
echo prompt>> temp.txt
echo lcd P:\_FTP\SENT>> temp.txt
echo ls>> temp.txt
echo mput *.*>> temp.txt
echo quit>> temp.txt

REM Launch FTP via DOS and process FTP info from text file
ftp -s:temp.txt

REM Temp file clean up
del temp.txt

Since we’re sending multiple pages, we used the “mput” command. I believe the “m” stands for “multiple”. When using the mput command, we at roguehelpdesk.com recommend using the “prompt” command prior to mput so it doesn’t prompt each time it tries to send/upload a file.

SOME COMMON ERRORS:
“500 PORT/EPRT (Active Mode/Extended Active Mode) is not supported. Use PASV/EPSV instead”
You can try the “passive” or “quote pasv” command but in many cases, this error usually means there is something blocking it like a firewall or antivirus.

REFERENCES/LINKS:
http://support.microsoft.com/kb/96269