Windows Programming/Programming CMD/Sample FTP

From Wikibooks, open books for an open world
Jump to navigation Jump to search

A simple program that will ftp one file. Do not name the file ftp.bat or it will recurse.

set ftpUser=
set ftpPass=
set ftpSite=
set file=

@echo off

cls

: FTP the stuff
> script.ftp ECHO USER %ftpUser%
>> script.ftp ECHO %ftpPass%
>> script.ftp ECHO put %file%
>> script.ftp ECHO quit
FTP -v -n -s:script.ftp %ftpSite%
@type NUL >script.ftp


: Delete scripts
del script.ftp /Q

cls