Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

If I am correct to assume that once I place a DVD/disk in my optical drive (or use a USB flash drive or external HDD for that matter; for arguments sake) that this action would in effect trigger an 'event' in Windows.

I would like to use this 'triggered event' to enable an entire copy of that device.


if my optical H: reads a disk OR the user closes the tray OR ...
then xcopy /S H: "F:\Copy of H"

ADDED: I am working with Windows XP; if any one could give me more of a push in the right dirrection that would help; I don't see how the autorun could help me; do I need to write some script for the autorun to use once this event is triggered? Or a program? Not sure what to do, thank you!

share|improve this question
Welcome to Super User! You can't explicitly ask for a programmer as we're a site meant for Super User, programmers can use Stack Overflow BUT your question is sufficiently on-topic on our site so there is no need to create another question there. Good luck on getting an answer... :-) – Tom Wijsman Feb 22 '11 at 17:55
Upgrade to a current version of Windows. Then you can trivially create a scheduled task on the corresponding event. – Joey Feb 25 '11 at 20:57

You can use VBScript (and other languages that use COM objects) with the FileSystemObject and its Drives property.

You would check the Drives object regularly for new drives (with a for statement) and then do something for each drive matching the criteria.

Then you can use the program execution functions from Windows Script Host to run a batch file to copy the files; or you can copy the files in the same drive detection script.

Here is a very useful help CHM for Microsoft's vbscript and jscript.

share|improve this answer
I really like what you posted; but I am totally preocupied right now building a whole new inventory/invoice/quote system for my friends business I wonder if I can burden you to help out some more as you seem to know what you are talking about if you could say write me an 'instruction book' I don't have the time to learn a whole new technology perse on this but I can put in the time to do it myself if I have some clear dirrection; I appologize for this and would greatly appreciate it! – Iceking007 Feb 25 '11 at 15:50

Best i can find is autorun.

i know autorun is disabled by default on writable (i.e. USB, but not CD/DVD) media; but i also know that somewhere in the machine security policy (secpol.msc) is the option to reenable it.

Windows 7 completely removed the ability to have AutoPlay on writable media. You're not even allowed to have an option appear on the dialog.

That's because millions of users would see the following dialog, and think clicking Open folder to view files is harmless:

enter image description here

That's because they're running Open folder to view files.exe.

share|improve this answer
You may also need to fiddle with antivirus settings, as this could be interpreted as virus-ey behavior. – Kara Marfia Feb 23 '11 at 7:08
ok that gives me a starting point; are you able to offer me any more information? - Thank you! – Iceking007 Feb 23 '11 at 14:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.