Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8593331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:57:50+00:00 2026-06-11T23:57:50+00:00

Need to write batch script which copies file from FTP to local drive I’m

  • 0

Need to write batch script which copies file from FTP to local drive

I’m trying to achieve this using cmd command prompt

inside batch file

please help me or paste any thread.

I found the answer thanks a lot but,

I need to use 2files script.txt and batch.bat

which contains script.txt code:

open ftp.server.com
username
password
cd folderpath/newfolder
get file1.xml
close
bye

and batch.bat code

ftp -v -i -s:script.txt
echo done!

But How can i do it using only .bat file so that I need only 1 file not 2 files

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T23:57:52+00:00Added an answer on June 11, 2026 at 11:57 pm

    As a starting point:

    1. Perform a NSLOOKUP for the FTP site, e.g. nslookup http://ftp.microsoft.com make a note of the IP address
    2. Edit the LMHOSTS file (in %systemroot%\system32\drivers\etc)
    3. Add line MicrosoftFTP #PRE e.g. 207.46.133.140 MicrosoftFTP #PRE
    4. Save the file
    5. Open a CMD.EXE session. Enter command: nbtstat -R This purges and reloads the name table cache
    6. Type command: net view \MicrosoftFTP You should see information on the site
    7. Now map a drive (to share data) net use * \MicrosoftFTP\data /user:anonymous
    8. All done. It will pass a drive letter for the connection

    The next step would be to make steps 1-4 automatic by scripting the commands and using file/string manipulation to update the hosts file if necessary.

    With a drive mapped you can then presumably do a normal Xcopy from one drive to another.

    Reference:
    http://answers.yahoo.com/question/index?qid=20080612073002AAruBR0

    UPDATE In response to your edit:

    In your main batch.bat file, dynamically create script.txt as follows:

    @echo off 
    @echo open ftp.server.com > script.txt
    @echo username >> script.txt
    @echo password >> script.txt
    @echo cd folderpath/newfolder >> script.txt
    @echo get file1.xml >> script.txt
    @echo close >> script.txt
    @echo bye >> script.txt
    

    Then do

    ftp -v -i -s:script.txt
    

    Finally – to tidy-up, remove the temporary script.txt:

    del script.txt
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to write a script in Matlab, which will read some data from
I am struggling to write a batch script which can read a CSV file
I am running Symfony 1.3.2 on Ubuntu. I need to write a batch script
I've been trying to write a ruby script using mechanize to batch upload a
Context : I need to call a Windows batch script which would update my
I am trying to write a Bash script to run a MySQL query from
I am trying to write up a batch file that would run a schedule
I'm normally a Linux guy, but I need to write a batch script on
I am currently trying to program a batch script which allows the user to
I am trying to write an Ant (1.8.2) script to shutdown HSQLDB (2.1.0) from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.