all groups > iis ftp > january 2007 >
You're in the

iis ftp

group:

FTP will not accept password from a batch file


FTP will not accept password from a batch file Ragnar Midtskogen
1/8/2007 8:41:19 PM
iis ftp:
Hi all,

I have run into a strange problem running FTP with a batch file.
The batch file is used to run various NTBACKUP backup operations, then FTP
the backup files to a different server.
The batch file runs correctly and creates all the backup files but does not
get logged in to the FTP server

Looking at the log file created by the batch file I can see that the
connection to the FTP server is made and the userid accepted.
But the password apparently is not, because I get error 331, need password.
In a command window I can connect OK manually with the same userid and
password.

I have set up backups on a couple of dozen of our servers using basically
the same batch file and they all work well.

The last part of the batch file, where I create and run an FTP script is
shown below:
----------------------------------------------------
REM create FTP script
echo open [IP address] > FTPscript.txt
echo [userid] >> FTPscript.txt
echo [password] >> FTPscript.txt
echo prompt n >> FTPscript.txt
echo cd E:\%DAY% >> FTPscript.txt
echo put %BackUpDir%\%ServerName%-backup.bkf >> FTPscript.txt
echo put %BackUpDir%\Registry_Settings\%ServerName%-Registry-backup.bkf >>
FTPscript.txt
IF %DAY%==Sun echo cd E:\SystemState
IF %DAY%==Sun echo put
%BackUpDir%\System_State\%ServerName%-SystemState-backup.bkf >>
FTPscript.txt
echo quit >> FTPscript.txt

FTP -s:FTPscript.txt

ERASE FTPscript.txt
------------------------------------------------------

Any comments or suggestions would be appreciated.

Ragnar

Re: FTP will not accept password from a batch file Bernard Cheah [MVP]
1/9/2007 4:06:45 PM
a) post the relevant iis ftp log file.
b) post the actual script content created. don't delete it first
c) if you run the batch file manually, does it work?

--
Regards,
Bernard Cheah
http://www.iis.net/
http://www.iis-resources.com/
http://msmvps.com/blogs/bernard/


[quoted text, click to view]

Re: FTP will not accept password from a batch file Ragnar Midtskogen
1/9/2007 8:40:23 PM
Thanks Bernard,

I did not delete the script file and took a look at it. I didn't see
anything wrong with it.
But when I tried running it from the command line the result was the same.
I was aware that the batch file code puts a blank at the end of each line
and it occurred to me that maybe the blank was read as part of the password.
So, I deleted the blanks and bingo! The operation ran correctly.
I guess this FTP server doesn't like those blanks.
None of the other servers care about them.

Ragnar

Re: FTP will not accept password from a batch file Bernard Cheah [MVP]
1/10/2007 12:03:56 PM
Sweet :) Glad you fixed it.

--
Regards,
Bernard Cheah
http://www.iis.net/
http://www.iis-resources.com/
http://msmvps.com/blogs/bernard/


[quoted text, click to view]

AddThis Social Bookmark Button