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

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?
Who is Participating?
Steve KnightIT ConsultancyCommented:
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!)

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

Hope this helps.

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"
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.

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"

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.
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.
Steve KnightIT ConsultancyCommented:
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!
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.