script to run a few commands when a usb drive is inserted

Discussion in 'Windows XP / Older OS' started by sunshine, Feb 14, 2008.

  1. sunshine

    sunshine MDL Novice

    May 10, 2007
    9
    0
    0
    Dear All,

    Is it possible to have a script that runs automatically when a usb drive is inserted? I basically need it to perform the below mentioned tasks:

    1. to run attrib -h -r -s -a *.*
    2. search and list certain files and folders based on an existing list
    3. del "directories / filenames of my choice" (basically few malware spreading on our computers via usb drives)

    Such that it saves time for manually cleaning many drives cause the list of baddies is quite small and restricted. I'm not exactly a scripting guy so please make your suggestions simple and may be ready to use and modify.

    :)

    If you like, you could king.of.heart.khan@gmail.com

    I'd gladly make myself available for any other info.

    Regards,
    sunshine.
     
  2. eurobyn

    eurobyn MDL Novice

    Oct 22, 2007
    8
    6
    0
    make a batch file and a autorun.inf file

    make a text file and place the code in it.
    save this file as .bat
    make a autorun.inf file and let it start the bat file

    place the autorun in the root of the usb key.

    this will work.