Parameter for FTP username and password

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
gmazza
Posts: 1
Joined: 04 Dec 2009 11:05

Parameter for FTP username and password

#1 Post by gmazza » 04 Dec 2009 11:11

Hey there,
I was wondering if it is possible to have a parameter passed for the username and password for my ftp batch job.
Here is my ftp login script:
username (obviously I put my username here)
password (obviously I put my password here)
ascii
prompt y
cd Training\Export

mget 45*.*
mget 62*.*
bye

It all works fine but I have tons of these scripts doing many things and if the password changes for the ftp site, then I need to go in ALL these scripts and change the password to the new one.
Is there anyway I can have 1 txt file storing the username and password, then when the password changes, I only need to change the one file with the new password.
Thus when calling my login script, I can pass the username and password from the stored txt file.
Is this possible??
Thanks for your help in advance!!

DosItHelp
Expert
Posts: 239
Joined: 18 Feb 2006 19:54

#2 Post by DosItHelp » 06 Dec 2009 03:50

gmazza,

This may work for you:
Use the FTP -s option for your shared login script and at the same time pass the 'real' ftp script (login sequence removed) in via input stream.

Code: Select all

ftp -i -s:"loginsequence.txt" <realftp1.txt
ftp -i -s:"loginsequence.txt" <realftp2.txt
...
Or better try the (newly added :wink:) batch with embedded ftp described here:
http://www.dostips.com/DtTipsFtpBatchScript.php#Batch.FtpBatchLoginSharing
and simply call:

Code: Select all

FtpLogin.cmd realftp1.txt
FtpLogin.cmd realftp2.txt
...

Hope this helps.

Post Reply