Emulated DOS FTP script ?
WinXPTalk.com Forum Index WinXPTalk.com
Forums for Windows XP users.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web winxptalk.com
Emulated DOS FTP script ?

 
Post new topic   Reply to topic    WinXPTalk.com Forum Index -> Windows XP General
Author Message
Steve
Guest





Posted: Thu May 19, 2005 4:25 pm    Post subject: Emulated DOS FTP script ? Reply with quote

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
Back to top
Pegasus (MVP)
Guest





Posted: Thu May 19, 2005 4:26 pm    Post subject: Re: Emulated DOS FTP script ? Reply with quote

"Steve" <sss@sss.com> wrote in message
news:%23On0KJIXFHA.2664@TK2MSFTNGP15.phx.gbl...
Quote:
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



Run your ftp command like so:

%windir%\system32\ftp.exe -s:%FTPSCRIPT% ftp19.********.com

and remove the "open" line from your script. You might also want
to run FTP in binary rather than ASCII mode - ASCII can turn
CRLFs into CRs.
Back to top
Mark Dormer
Guest





Posted: Thu May 19, 2005 4:26 pm    Post subject: Re: Emulated DOS FTP script ? Reply with quote

Remove the -n parameter

%windir%\system32\ftp.exe -n -s:%FTPSCRIPT%
%windir%\system32\ftp.exe -s:%FTPSCRIPT%

And lose the spaces, it stuffs up the login.
It tries to login an "******* "

Quote:
ECHO open ****** > %FTPSCRIPT%
ECHO ***** >> %FTPSCRIPT%
ECHO ****** >> %FTPSCRIPT%
ECHO cd pub >> %FTPSCRIPT%
ECHO cd temp >> %FTPSCRIPT%
ECHO ascii >> %FTPSCRIPT%
ECHO send %RESULTS% >> %FTPSCRIPT%
ECHO bye >> %FTPSCRIPT%

ECHO open ******> %FTPSCRIPT%
ECHO *****>> %FTPSCRIPT%
ECHO ******>> %FTPSCRIPT%
ECHO cd pub>> %FTPSCRIPT%
ECHO cd temp>> %FTPSCRIPT%
ECHO ascii>> %FTPSCRIPT%
ECHO send %RESULTS%>> %FTPSCRIPT%
ECHO bye>> %FTPSCRIPT%


__________________________________________

This one works,. just change the server, user and password
----------------------------------------------

@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 your.ftp.server> %FTPSCRIPT%
ECHO username>>%FTPSCRIPT%
ECHO password>>%FTPSCRIPT%
ECHO cd pub>>%FTPSCRIPT%
ECHO cd temp>>%FTPSCRIPT%
ECHO ascii>>%FTPSCRIPT%
ECHO send %RESULTS%>>%FTPSCRIPT%
ECHO bye>>%FTPSCRIPT%


:: Execute ftp using script
%windir%\system32\ftp.exe -s:%FTPSCRIPT%

:: Cleanup tmp files
rem del %FTPSCRIPT%
rem del %RESULTS%
@echo off

_______________________________________________________________

Regards
Mark Dormer


"Steve" <sss@sss.com> wrote in message
news:%23On0KJIXFHA.2664@TK2MSFTNGP15.phx.gbl...
Quote:
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 ****** > %FTPSCRIPT%
ECHO ***** >> %FTPSCRIPT%
ECHO ****** >> %FTPSCRIPT%
ECHO cd pub >> %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

Back to top
 
Post new topic   Reply to topic    WinXPTalk.com Forum Index -> Windows XP General All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Office Forums Access Forums Windows Server Exchange Server Help
New Topics Powered by phpBB