The Autorun.inf file
and the AutoRun technology
When you create a CD/DVD menu with
SamLogic CD-Menu Creator you have the option to create a file with the
name Autorun.inf. This file is very important if you want to
create an autorun / autoplay menu (a menu that opens automatically) because it instructs Windows
which
application that should be launched when the CD or DVD is inserted in
the drive.
The Autorun.inf
file must always be located in the root
directory of the CD/DVD. If you place it in a sub directory Windows
will not found it. When you insert the disc Windows will look after Autorun.inf
in the root directory and if it find it, it will read the file and
interpret the contents of it.
This feature to
automatically start programs on compact
discs is sometimes referred as the Windows AutoRun technology. All
Windows since Windows 95 have this technology built-in. Almost all
software that is distributed via CD or DVD uses this technology to
automatically open menus or start programs. You can read more about this
in the related article: Why Create an
Autorun Menu For Your CD or DVD?.
What is inside
Autorun.inf?
Autorun.inf is a text file
and in its basic form it look like this:
[AutoRun]
OPEN=MYAPP.EXE
The OPEN
command
specifies which program that should be run when the CD/DVD is inserted
in the drive. In the example above a program with the name MYAPP.EXE
will be executed.
Autorun.inf can also
specify an icon that will represent your application's CD or DVD in
the Windows user interface (for example in Windows Explorer). To specify a new icon to the CD/DVD drive, Autorun.inf
should contain the following commands:
[AutoRun]
OPEN=MYAPP.EXE
ICON=MYICON.ICO
The ICON
command
specifies the filename of the new icon to display. In this case an
icon with the filename MYICON.ICO will be used.
In the examples above the program file and the icon file most be located
in the root directory of the CD/DVD, but you can also access files
located in a sub directory on the CD/DVD if you specify a relative path.
Example:
[AutoRun]
OPEN=FOLDER\MYAPP.EXE
The OPEN and ICON
commands are the most used in Autorun.inf files, but there are
more commands available. You can for example specify a new disc label
with the LABEL command. The
LABEL command has the benefit that you can
specify labels that contains more than 16 characters (16 is the normal
limit for CD/DVD labels).
A list and a description of the commands that can be used in Autorun.inf can be
found at the following page: Autorun.inf
- Commands.
If you want a more detailed information about the commands
you can also take a look at the following Microsoft page:
Autorun.inf Entries.
Is it possible to
show documents automatically with Autorun.inf?
In newer windows it is possible,
but in older Windows it is not. There is a command named
SHELLEXECUTE that can open documents if
the filename extension (.doc, .avi, .pdf etc) is registered in the
system. But if you distribute a commercial application that should
work in all Windows versions it is recommended not to use this command
because this command will not work in for example Windows 95 or 98.
Use instead a document launcher application that works in all Windows
versions. A document launcher application will take a path to the
document file as a parameter and open the dokument by calling proper
functions in the system. An example of a document launcher application
is
SamLogic Autorun Creator.
In Windows XP there is also a new
technology, called AutoPlay, that automatically opens documents on
CD's and DVD's. AutoPlay will detect content such as pictures, music,
or video files and then automatically launch an application to play or
show the content. This technology is not available in older Windows.
In some computers
the AutoRun feature do not seems to work, why?
As mentioned before, all Windows since
Windows 95 have the AutoRun technology built-in, but in some computers
this feature can be disabled. Administrators can disable this features
in client computers on a network for security reasons and some
applications, for example CD burning programs, can sometimes also disable this
feature.
If AutoRun is disabled on a
computer you can enable it by changing a value in the registry. There
is a value with the name NoDriveTypeAutoRun
at the following key:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer
that probably is B5
(hexadecimal). If that is the case, you can change it to the
hexadecimal value 95 and then restart the computer. After the
reboot the computer should have the AutoRun feature enabled again.
The NoDriveTypeAutoRun
value contains a bit mask where every bit that is set disables a drive
type. The default value for NoDriveTypeAutoRun
is 95, giving the bit pattern 10010101. Bit number 5 enables/disables
AutoRun on CD-ROM drives and as default this bit is cleared (zero). By
setting this value to B5, the bit number 5 will be set (one) and the
CD-ROM drive is disabled. The bit pattern for B5 is 10110101.
It's also possible to
enable/disable AutoRun on other drive types than CD-ROM by
clearing/setting other bits in the NoDriveTypeAutoRun
value. For example it's possible to have AutoRun enabled for floppy
disks. In the table below you find some of the bits and what drive
types they represent.
Bit 2 = Disk can be removed from drive (such as a floppy disk)
Bit 3 = Disk cannot be removed from drive (a hard disk)
Bit 4 = Network drive
Bit 5 = CD-ROM drive
Bit 6 = RAM disk
To enable AutoRun you must clear
the corresponding bit. You
can read more details about enabling/disabling the AutoRun feature at
the Microsoft page:
Enabling and Disabling AutoRun.
This article refers to:
SamLogic
CD-Menu Creator 2008
Other articles
More articles are available from the article index
page.
|