want to create batch file

Asked By C_A P
20-Nov-09 07:06 AM
Earn up to 0 extra points for answering this tough question.
hi to all,

i would like to create batch file that run when i insert usb pen drive, flash drive.
how to create it?

i dont want to open pen drive autorun file?

thanx in advance

  Autorun.inf Structure

Venkat K replied to C_A P
20-Nov-09 10:24 AM

The autorun.inf file is the key to getting your USB drive (or CD-ROM drive, for that matter) to perform certain actions automatically.

The autorun.inf file is a simple text file that can be opened up in any text editor (e.g. notepad). It always starts with a section header of:

[autorun]

Below this header is a list of different options. Each of these options is in the following format:

option=value

where

option is the option that you want to set and value is the value that you are setting for that option. So, if you had an option foo and you wanted to be set to bar, then you would enter:

foo=bar

(Do not use foo=bar in your autorun.inf file as it is only an example, not a real option setting.)

That is all there really is to understand about the structure of an autorun.inf file. On to doing some actual cool stuff with it!

Check this link for more information how to autoplay etc:

http://dailycupoftech.com/usb-drive-autoruninf-tweaking/

Thanks,

  autorun batch file or script

C_A P replied to Venkat K
21-Nov-09 12:46 AM
i dont want autorun file to run but when i insert pendrive it should run any particular file
i want to write that script

  Use one of these.

[)ia6l0 iii replied to Venkat K
22-Nov-09 11:40 AM
The XP and the later versions of all Microsoft Operating systems do not allow you to autorun a program from an USB device in a easier manner. It is more different from the traditional CD-Rom autorun file.

Having said that, if you would really need to autorun a file, this is how you would do it. 

Open Notepad and create a file called "autorun.inf" without quotes, and with the following contents.

[autorun]
open=start.exe
action=Run start exe

Save this file in the root of the USB drive. And also note than put the start.exe in the root folder itself and try avoiding specifying complicated relative paths to the exe file.

If this does not work, just dump this, and install one of the many utilities like the "AutoRun USB".  You can download it from here.


Create New Account