Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I plan to distribute a free CD that automatically copies files to a connected usb device. This process will be done on the computers of the users that obtain the cd. The CD will contain an autorun.ini file that will instruct the computer to copy a set of files located on the a specific directory on the connected usb device. The usb drive letter is not the same on all the systems, therefore...Windows XP should automatically know the drive letter of the usb device before the copy operation begins. What would be the best way of creating a short batch file or script that I can place on the CD to execute this process? Also, please note that it is NOT feasible or recommended to include a batch file on the USB devices to sync this operation due to the explanation at the beginning of this paragraph. :) Thank You All

share|improve this question
Starts in the title are not nessesary – TheLQ Jul 8 '10 at 1:49

To the best of my knowledge, what you are attempting is impossible without exploiting some security flaw in Windows. Windows deliberately prevents things from automatically acting on their own. It's not surprising, since this behavior is similar to that of malware.

The best thing you can do is simply include an autorun option, which when chosen, does what you want it to do.

share|improve this answer

i don't think that such a tool exists...

but here is what you can do...

you can create a batch ".bat" file in you USB that contains the DOS commands to copy files from CD-ROM drive... and launch it on USBs autorun.. so when you will put the CD in and after that plugin the USB the files will be copied automatically...

but.... this solution will be specific for your PC.. as it will be using drive letters... ........this solution will be order specific meaning you will have to plugin USB after or when the CD is already loaded...


pay me ;) and i will write you a smart tool...

share|improve this answer
just kidding about paying :) – Junaid Saeed Jul 8 '10 at 0:44
My description above is based on a CD that will be used by a small group of technicians in various locations. I was thinking that the environmental variable would specify what drive letter is assigned to the usb device. – Ray Nathan Jul 8 '10 at 0:49
Thanks for replying a while ago "Moon"...Also, it would not be advantageous to include a batch file on the USB device for particular reasons. Curious...How much would a smart tool cost and could that file be included on my Cd? – Ray Nathan Jul 8 '10 at 0:57

Just put a .bat file on the USB device that does set usbdrive=%d~0 then link to in the autorun.inf.

share|improve this answer
I appreciate the reply "Hello71" but again...Placing files on the USB device is not possible because the CD's are being release to the public for free. It is slightly impossible to have all the takers of the cd, install the batch file on their usb devices. Their has to be a way to have the "fix" on the CD and have it recognize the appropriate usb drive letter during execution of the file copy process. Thanks – Ray Nathan Jul 8 '10 at 1:37
This might be possible with PowerShell, though. – Hello71 Jul 8 '10 at 15:32
yes it is possible via Powershell but his gaol is to put it in a CDs that is going to be distributed... well for that RAY you need to write some program ( EXE or COM ) and put them in the CD with an autorun... trust me the program is going to be really simple and may be 15 to 20 lines of code but then there are two things that can go wrong.... 1. Won't work iff the autorun\autoplay of CD-ROM is disabled by the user which is a very rare case only advanced users do that 2. the copy will be performed to any USB MASS STORAGE DEVICE (USB Disks, MP3 Players, Mobiles, USB Connected, Harddisks etc) – Junaid Saeed Jul 13 '10 at 5:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .