Using autorun, you can set a program to start up automatically when you connect the drive to a computer. You can also use the same script for a data CD-ROM. Note that some computers have autorun disabled for security purposes.
Open up notepad and paste the following script:
[autorun]
ShellExecute=filename
Label=description
UseAutoPlay=1
Make sure you replace filename with the full path to the file. For example, a file called program.exe in a folder called “programs” on the thumb drive would be /programs/program.exe
Replace description with a short description of the program, for example, Mozilla Firefox.
Save the file as autorun.inf, making sure you select “All Programs” from the save menu, not “Text document”!