Store password in ftp file


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

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
  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.
Who is Participating?
Bill PrewConnect With a Mentor Commented:
You can also try replacing:

  echo user user  
  echo password password


  echo user myuser mypassword

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%
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).
Bill PrewCommented:
You might want to try this as well:

  echo quote user myuser  
  echo quote password mypassword

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:

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.