Wednesday, May 16, 2007

How to create an Autorun CD?

Have you noticed that the CDs that you buy or the CDs that comes with books runs automatically when you insert the CD into your CD drive. This is because of the 'Autorun' facility in the CDs.

But using this Auto Run feature you can only execute executable programs. Therefore the webpages and any other files cannot be opened automatically using Autorun.

Imagine that you want to copy the powerpoint presentation that you created or the Word document into a CD and pass it to your friend. Will it not be nice if the powerpoint presentation or the document opens automatically when the friend inserts the the CD into his computer?

Now every computer comes with a CD writer. You may wonder whether the CDs that you create using your CD writer can use the Autorun facility. Yes you can.

You have to create a file named 'autorun.inf'. You can create this file using a normal notepad. You have to copy this file in the root folder of the CD. If you want to use any icon then you can also copy an icon file into the root folder.

How to execute an executable file in a CD automatically.

For example assume that you have a myprogram.exe file and myicon.ico file. And you want to run myprogram.exe file automatically when the CD is inserted

Keep both these files in the same folder.

Open a notepad and type these three lines in the notepad

(autorun)
open=myprogram.exe
icon=myicon.ico

save this file as 'autorun.inf'.

If your executable file is not in the root folder then you have to specify the full path. (eg. open=myfoler/myprogram.exe)

To create autorun cds for non executable files

If your file is not an executable file like .xls, .doc, .htm, .html, .mp3, .wma, .wav, .mpg, .avi, .jpg, .bmp, .zip or any other file then how to write the autorun.inf file.

Let us assume that you have index.htm file as the autorun file. Then the autorun.inf file will be as follows:

(autorun)
open=start index.htm
icon=myicon.ico

In this case when you insert the CD, a small black window will open and close very fast and then you will see the index.htm file in Internet Explorer.

If you do not want the dos window to open then create the autorun.inf file as below:

(autorun)
shellexecute=index.htm
icon=myicon.ico

However the shellexecute will not work in Windows 98 or older versions. It will work in Windows XP and the newer versions of Windows. In earlier versions you can use the DOS batch file. So you will have one more file autorun.bat in addition to autorun.inf

(autorun)
open=autorun.bat index.htm
icon=myicon.ico

and the autorun.bat file will as follows:

echo off
"start % 1
"exit

How to use autorun.exe

In the above example we used two files autorun.bat and autorun.inf. However the use of autorun.bat is not a wise option. Because a batch files cannot handle errors.

Therefore you can use the free autorun.exe instead of autorun.bat

autorun.exe file is provided by Tarma software research freely. Anybody can use this software. You can download autorun.exe from www.tarma.com/products/index.htm . Download this file and copy it to the root folder of the copied CD.

The autorun.inf file should be as follows:

(autorun)
open=autorun.exe index.htm
icon=myicon.ico

No comments: