• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 405
  • Last Modified:

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.
  • 2
  • 2
1 Solution
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%
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

Bill PrewCommented:
You can also try replacing:

  echo user user  
  echo password password


  echo user myuser 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:



Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now