S
Steve
Trying to make a batch file that will handle some FTP tasks for me.
I have a batch file that creates a FTP script file.
Here is the batch file:
<code>
@echo off
:: Execute the ping and store results in tmp file
SET RESULTS=C:\updextipres_neverstill.txt
ping -r 1 -n 1 www.yahoo.com > %RESULTS%
:: Create FTP script for this site
SET FTPSCRIPT="C:\FTPScript.txt"
ECHO open ftp19.******.com > %FTPSCRIPT%
ECHO ******* >> %FTPSCRIPT%
ECHO ****** >> %FTPSCRIPT%
ECHO cd webroot >> %FTPSCRIPT%
ECHO cd temp >> %FTPSCRIPT%
ECHO ascii >> %FTPSCRIPT%
ECHO send %RESULTS% >> %FTPSCRIPT%
ECHO bye >> %FTPSCRIPT%
:: Execute ftp using script
%windir%\system32\ftp.exe -n -s:%FTPSCRIPT%
:: Cleanup tmp files
del %FTPSCRIPT%
del %RESULTS%
@echo off
</code>
This create the script file that looks like this:
<code>
open ftp19.******.com
username
password
cd webroot
cd temp
ascii
send C:\updextipres_neverstill.txt
bye
</code>
When I run the batch file, this is what I get:
<console output>
C:\>update_external_ip.bat
ftp> open ftp19.********.com
Connected to ftp19.brinkster.com.
220 Microsoft FTP Service
ftp> brinkusername Invalid command.
ftp> password Invalid command.
ftp> cd webroot
530 Please login with USER and PASS.
ftp> cd temp
530 Please login with USER and PASS.
ftp> ascii
530 Please login with USER and PASS.
ftp> send C:\updextipres_neverstill.txt
530 Please login with USER and PASS.
530 Please login with USER and PASS.
ftp> bye
221
</console output>
Does anyone know what I'm doing wrong? I'm creating the script so that I
can use variables with FTP.exe.
Thanks for any help or ideas!
Steve
I have a batch file that creates a FTP script file.
Here is the batch file:
<code>
@echo off
:: Execute the ping and store results in tmp file
SET RESULTS=C:\updextipres_neverstill.txt
ping -r 1 -n 1 www.yahoo.com > %RESULTS%
:: Create FTP script for this site
SET FTPSCRIPT="C:\FTPScript.txt"
ECHO open ftp19.******.com > %FTPSCRIPT%
ECHO ******* >> %FTPSCRIPT%
ECHO ****** >> %FTPSCRIPT%
ECHO cd webroot >> %FTPSCRIPT%
ECHO cd temp >> %FTPSCRIPT%
ECHO ascii >> %FTPSCRIPT%
ECHO send %RESULTS% >> %FTPSCRIPT%
ECHO bye >> %FTPSCRIPT%
:: Execute ftp using script
%windir%\system32\ftp.exe -n -s:%FTPSCRIPT%
:: Cleanup tmp files
del %FTPSCRIPT%
del %RESULTS%
@echo off
</code>
This create the script file that looks like this:
<code>
open ftp19.******.com
username
password
cd webroot
cd temp
ascii
send C:\updextipres_neverstill.txt
bye
</code>
When I run the batch file, this is what I get:
<console output>
C:\>update_external_ip.bat
ftp> open ftp19.********.com
Connected to ftp19.brinkster.com.
220 Microsoft FTP Service
ftp> brinkusername Invalid command.
ftp> password Invalid command.
ftp> cd webroot
530 Please login with USER and PASS.
ftp> cd temp
530 Please login with USER and PASS.
ftp> ascii
530 Please login with USER and PASS.
ftp> send C:\updextipres_neverstill.txt
530 Please login with USER and PASS.
530 Please login with USER and PASS.
ftp> bye
221
</console output>
Does anyone know what I'm doing wrong? I'm creating the script so that I
can use variables with FTP.exe.
Thanks for any help or ideas!
Steve