Auldfart's How To Guides

Windows
AutoRun
What is AutoRun?
You probably have noticed this at one
point or another. You inserted a CD, either a software CD or a music CD, into
your CD-ROM drive, and suddenly a window appears out of nowhere on your screen
and/or music suddenly starts playing.
Nope, it's not black magic and
there is no little gremlin inside your PC pushing the Play button. It's the
Windows AutoRun feature.
How does it work?
The way this works is that Windows
checks your CD-ROM drive every five seconds to see if a CD has been inserted. If
it detects a CD in the drive, it will then look at the contents of the CD and
see if there is a file called Autorun.inf.
(Note: It works slightly different with music CDs but more about that later.) If
it finds such a file, it opens it and executes the command found in that file.
Go ahead and take a look. Insert one
of your program CDs into your CD-ROM drive, for example your Windows CD. Within
a few seconds of inserting that CD, you will get the Windows welcome screen.
Close that screen by clicking on the X in the top right corner. Now let's see
what just happened. Open Windows Explorer and select the CD-ROM drive. Now look
for a file called Autorun.inf.
When you found it, highlight it by clicking on it once, then hold down the Shift
key on your keyboard and right-click on the file. In the resulting menu, select
Open With ... You'll get a window where you want to choose Notepad. In the
Notepad window, you'll see something like this:
[autorun]
OPEN=CDSAMPLE\AUTORUN\AUTORUN.EXE
ICON=CDSAMPLE\AUTORUN\WIN98CD.ICO
The first line tells Windows that this is indeed an autorun file and that the
following command is to be executed.
The second line tells Windows to OPEN the file AUTORUN.EXE which can be found at
the path CDSAMPLE\AUTORUN on the CD.
The third line tells Windows to
display the icon WIN98CD.ICO, which can be found at CDSAMPLE\AUTORUN on the CD,
for this CD in the Explorer window.
Go see for yourself. On the Windows CD, find the folder CDSAMPLE\AUTORUN.
And it contains exactly those two files.
But how can
you disable the AutoRun feature if you suspect it causes CD-ROM problems or just
don't want it to launch the CD you are about to insert?
How to disable AutoRun
You might want to turn off AutoRun, either because your
CD-ROM drive is behaving funky, or you just don't want it to launch the CD
you're about to insert into the drive. There are two ways of doing so.
The first method is permanent until
you change it back again. Go to Start/Settings/Control Panel/System/Device
Manager and make sure View Devices by Type is selected. Double-click the CD-ROM
line and note how it produces a new line underneath.
This new line describes the type of CD-ROM you have. Double-click that new line
and you should see the CD-ROM Properties window. Select the Settings tab and
look for a checkbox labeled Auto Insert Notification.
To disable AutoRun, uncheck this box, click OK twice until prompted to restart
your PC, then do so. AutoRun is now disabled until you check that box again and
restart your PC.
The second
method is only temporary. To disable AutoRun just one time, open the CD-ROM
drive drawer and place the CD in the drawer. Don't close it yet! Hold down the
Shift key on your keyboard and then close the CD-ROM drive drawer.
Keep the Shift key held down for another 5-10 seconds after the drawer closes,
then let go. The Shift key I mean. You'll notice that nothing will happen. But
the next time you insert another CD, AutoRun will kick in again unless you hold
down the Shift key again.
To stop only
music CDs from running automatically, go to Windows Explorer, click the View
menu and select (Folder) Options. Select the File Types tab and scroll until you
see AudioCD. Highlight it and click the Edit button.
In the resulting window, you'll see the word Play in the Actions box. It is bold
if the AutoPlay feature is enabled. Click the Set Default button and Play will
no longer be in bold. You're done.
How to enable AutoRun
If for some
reason AutoRun doesn't work, do this: Go to Start/Settings/Control
Panel/System/Device Manager and make sure View Devices by Type is selected.
Double-click the CD-ROM line and note how it produces a new line underneath.
This new line describes the type of CD-ROM you have. Double-click that new line
and you should see the CD-ROM Properties window.
Select the Settings tab and look for a checkbox labeled Auto Insert
Notification. To enable AutoRun, check this box, click OK twice until prompted
to restart your PC, then do so. AutoRun is now enabled.
If that did not work, some registry
hacking is on the menu. Go to Start/Run, type Regedit and click OK to open the
registry editor. Drill down the following key:
HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Policies \
Explorer
Now look at
the NoDriveTypeAutoRun key on the right. To enable AutoRun, right-click on that
key, select Modify and change the value to 0000 95 00 00 00 and click OK. Now
quit the registry editor and restart Windows for this to take effect.
The number 95 is a hexadecimal value and is the sum of all device types to
disable AutoRun for. The values and devices are:
01h Unknown drive type
02h Drive without root directory
04h Removable drive
08h Fixed drive
10h Network drive
20h CD-ROM
40h RAM disk
80h (not yet specified device types)
By default,
Windows disables AutoRun for not yet specified device types (80h), network
drives (10h), removable drives (4h), and unknown drive types (01h). This adds up
to, surprise, 95h which is the value mentioned above.
AutoRun tricks: Change a drive icon
Here's a
little trick you can use to change the icon for a drive, e.g. your hard drive,
from the boring default icon to something else. First, use Notepad to create a
file called Autorun.inf and save it in the root directory of the drive whose
icon you want to change.
In that file, you need to enter
two lines. Here's an example:
[autorun]
ICON=C:\Windows\System\Shell32.DLL,21
This tells
Windows to display icon number 21 for whatever drive you saved this autorun.inf
in. Shell32.DLL is a Windows system file that contains all the Windows icons.
But you can also create your
own icon or point to another icon somewhere else on your hard drive.
Just specify the path and file name in the ICON= line. If it doesn't seem to
work right away when you're done, you might have to go to View/Refresh or hit
the F5 function key to refresh the screen and have Windows update the icon.
AutoRun tricks: Make your own CD AutoRun
Another situation you can use the
AutoRun feature for is if you have a CD burner and created your own CD. You
could write a batch file to run whatever program is on the CD, e.g. an
installer.
Then create an
Autorun.inf file and put in the root directory of the CD and specify in that
file to run the batch file automatically. For example:
[autorun]
OPEN=Path\YourBatchFile.BAT
ICON=Path\YourCustomIcon.ICO


|