Store password in ftp file

Hello,

I am trying to get the password to store into this ftp file but cannot accomplish this.
Can someone assist me on this?

@echo off
setlocal

REM Prompt user for file name
set /P File=Please enter filename to transfer:
if "%File%" EQU "" (
  echo ERROR - No filename specified.
  exit /b
)

REM FTP file
(
  echo open 10.10.10.120
  echo user user  
  echo password password
  echo lcd c:\temp
  echo cd /home/user
  echo get %File%
  echo quit
) | ftp -n -i

I tried to add 'echo password password but it still prompts for the password.
Tried using the set command but still get prompt for the password.

Any help would be appreciated.

Thank you.
cbonesAsked:
Who is Participating?
 
Bill PrewConnect With a Mentor Commented:
You can also try replacing:

  echo user user  
  echo password password

with:

  echo user myuser mypassword

~bp
0
 
Paul TomasiCommented:
Try adding/changing the following...

Add this line near the top of your batch file. Replace '<your password>' with your ftp password (don't include the '<' and '>' characters):

set password=<your password>

then change the line 'echo password password' to:

echo password %password%
0
 
Paul TomasiCommented:
or, omit the word 'password' and just echo your ftp password, like this:

echo <password>

where '<password>' is your ftp password. (don't include the '<' and '>' characters).
0
 
Bill PrewCommented:
You might want to try this as well:

  echo quote user myuser  
  echo quote password mypassword

~bp
0
 
Steve KnightIT ConsultancyCommented:
Guess you've got that one covered :-)

I normally find either just the password on line by itself or after username are most likely combinations. Got these here:

 http://scripts.dragon-it.co.uk/links/batch-ftp-scripting

Steve
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.