Store password in ftp file

Posted on 2012-09-16
Last Modified: 2012-09-17

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.
Question by:cbones
    LVL 11

    Expert Comment

    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%
    LVL 11

    Expert Comment

    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).
    LVL 51

    Expert Comment

    by:Bill Prew
    You might want to try this as well:

      echo quote user myuser  
      echo quote password mypassword

    LVL 51

    Accepted Solution

    You can also try replacing:

      echo user user  
      echo password password


      echo user myuser mypassword

    LVL 43

    Expert Comment

    by:Steve Knight
    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

    Courses: Start Training Online With Pros, Today

    Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

    Join & Write a Comment

    Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
    Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now