Batch file to copy files over FTP, script to put file in all users startup

Posted on 2011-10-12
Medium Priority
Last Modified: 2012-05-12
I need to create a batch file that will copy a few files down from a FTP server, create a folder on the C drive, and then put the files in the folder.  Next I need they batch file to copy a file to the all users startup folder (differing between XP and windows 7).  Any ideas?
Question by:kharoldsen

Assisted Solution

pritamdutt earned 668 total points
ID: 36960430
here are the commands you need to carry out or improvise on:

mkdir c:\download
cd /d c:\download
ncftpget -u <username> -p <password> <remote server> <remote files>
copy <filename>  "%allusersprofile%\Start Menu\Programs\Startup"

Open in new window

NCFtp is an excellent ftp client which downloaded for free from http://www.ncftp.com/ncftp/.

Hope this helps.


Expert Comment

ID: 36960598
You can download "ncftpget" from here:


as 'ncftpget' is not recognized as an internal Windows command.

Look under "Download NcFTP Client" and take "NcFTP Client 3.2.5 for Microsoft Windows"

Assisted Solution

sugunakar earned 664 total points
ID: 36960608
you can use the ftp command that comes with windows.
I added ftpbatch.txt which contains the basic ftp commands to perform your task.
use that file like following:
ftp -v -i -s:c:\ftpbatch.txt
then use below command to copy to startup folder.
copy a*.* "c:\Documents and Settings\All Users\Start Menu\Programs\Startup"

So finally the batch file would like following:

ftp -v -i -s:c:\ftpbatch.txt
copy a*.* "c:\Documents and Settings\All Users\Start Menu\Programs\Startup"

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.


Expert Comment

ID: 36960628
Please note that %allusersprofile% environment variable will ensure that you copy the file in correct location across Windows XP/Vista/7 OS.

%allusersprofile% Environment variable contains the profile path for All Users Profile as required by you.
LVL 43

Accepted Solution

Steve Knight earned 668 total points
ID: 36960880
Personally I prefer to keep the ftp commands all in one, e.g. See my option 3 on my page here:



@echo off
md c:\somedir
(echo open x.x.x.x
echo user username
echo password pass
echo lcd c:\somedir
echo cd /remotedir
echo bin
echo get somefile.txt
echo get another.txt
echo mget *.txt
) | ftp -i -s

where the get lines can get one file each (as many as you need) and the mget line can get multiple from a dir in one go.

You can hide the password rather than specifying it in the batch file with a nifty way here:


As to the copying to shortcut are you planning on doing this as part of a login script (easy like has been said) or remotely pushing to all machines (less easy!)

LVL 16

Expert Comment

ID: 36961162
It might be a better design to have one server on your network that responsible for fetching the files from the FTP site.  You could have it set up to constantly monitor the FTP site and download any new or updated files.  All downloaded files would be put into a shared network folder.  

You could make a Scheduled Task and have it run every 5 minutes or you could use Robo-FTP to make a Windows Service that literally polls the site non-stop to instantly grab any changes sends you an email or sms text if there are any connectivity or transfer problems.

Anyway, your individual PCs will just grab the file from the network share instead of from the FTP site.  If something changes in the future, for example the password of the FTP site, you only have to make the change in one place.  Also this approach is more robust because any users that log in during an internet outtage (or FTP server outtage) will still get the files.
LVL 43

Expert Comment

by:Steve Knight
ID: 36961295
Good point there.  I read it incorrectly as he wanted to bring down these files from ftp (issue 1) and then create a file in startup for all users, i.e. on all machines.

Agreed would be better scheduled to download / script on one machine!

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month16 days, 20 hours left to enroll

864 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