The autorun discussed here is for CD distribution of applications, such as computer games and install discs.
CREATING AUTORUN FILES-THE WHY:
Whenever you put a game disc into a cd drive, a window will pop up prompting you to install it (in most cases). Well, how can you get this functionality in you own programs? Simple. It takes less than five minutes in most cases for a simple application.
Well, why make autorun files? The answer is obvious. Some users aren't as well learned in computers, and wouldn't know what files to execute. If a window automatically popped up it would make these peoples lives much easier. Also, I personally think it looks much more professional than having someone search their disc for a readme file, opening that, and then manually opening the files they need to.
CREATING AUTORUN FILES-THE HOW:
The thing that makes autorun possible is the Autorun.inf file. These can be created in any simple text editor, like notepad. Simply open up that text editor and save it to your intermediary location with exactly that name: "Autorun.inf". Now, what you will need to put in there is relatively straightforward. First, you will need to start it off with: [autorun] . Next, the most important aspect of all. We need to create the code to open the file that we want when autorun is executed, so we need to add open=YourFileHere.exe. Also, although it is optional, its always good to have an icon for your window, so go ahead and add icon=YourIconHere.ico if you have an icon (note: I found a plugin for photoshop to edit ico files. You can find it here and download it for free). Finally, another optional command, though very useful, is labeling the drive. You can do that by adding label=YourLabelTextHere . So, the rudiments of an Autorun.inf file are:
[autorun] open=YourFileHere.exe icon=YourIconHere.ico label=YourLabelTextHere
CREATING AUTORUN FILES-BELLS & WHISTLES
You can add (in addition to the above) [autorun.platform] where platform is mips, alpha, ppc, among others. Then you can change the open values to platform-specific programs. You can also change the open line to shellexecute=YourFileHere.randomextension if your file is not a .exe file. Finally, you can insert UseAutoPlay=1 , but this command will be ignored prior to Windows XP, so the normal autorun will still execute. For more information, go to the Microsoft Autorun.inf Entries Page.
TESTING AUTORUN FILES IN WINDOWS 95 OR LATER (I THINK)
Microsoft has a long way of changing the Registry to test autorun, but if you only want to do a quick test, you can type in the following code to a command prompt, where YourPathHere is the directory Autorun.inf is in (assuming you aren't using T: as a drive):
SUBST T: "C:\YourPathHere"
This will trick the system into thinking that the autorun file is in the root directory of the new drive, T:, and run the autorun. Now, you should delete the drive so you can use that drive letter to test again, as this method only allows you to test once with a drive. This is done by typing this code into a command prompt:
SUBST T: /D
Now, type SUBST without any paramaters. It should display a blank line, indicating you have no virtual drives (unless you have one other than T:, the one we used to test).