How to Create an Autorun Picture Disc
© 2008 TheTeachingBox.com

Everyone has pictures that they would like to share with their friends and family.  Although there are many places on the internet that can host pictures, sometimes it is best to burn them to a disk and save them the "old fashioned way".  The goal of this tutorial is to create a Disc (CD or DVD) that can be placed into the CD/DVD drive of a computer.  The computer will then automatically launch an application to allow the user to view the pictures on the disc.

In reality this is a seamless operation, but there are a number of things we must do to prepare a CD (or DVD) to function in the manner that we wish.

The three things we must do:
1.  Understand how to use the autorun.inf file.
2.  Know a little bit about .bat (batch) files.
3.  Have a simple picture viewing program that we can set to run automatically.

Autorun.inf



Thankfully most modern Operating System installations have the autorun functionality enabled.  This is the default setting, although there may be some systems that this functionality is turned off.  They should be few and far between.  Nevertheless you will see that our implementation of the autorun function will leave us an alternate way to accomplish our goal. 

Autorun is actually a function that is built into the operating system.  This should not be confused with the AutoPlay function that exists in Microsoft Windows.  AutoPlay will bring up a dialog box after a CD or DVD disk is inserted.  The dialog box will give the user choices on how to handle the content on the disk.  Autoplay is a relatively new function to XP and Vista.  The autorun function goes all the way back into the Windows 95/98 realm.  This backwards compatibility is beneficial to us, because our disk will work regardless of the Windows Operating System of our target user. 

The autorun.inf is a simple text based file that instructs the autorun function to perform tasks.  The file must follow a certain format and it must be located in the root directory of our CD or DVD disc.  For our purposes we will utilize the most basic functionality and have the autorun function execute a program of our choice.  We will have autorun.inf file instruct the autorun function to execute a batch file.  We could have the autorun.inf file run the picture viewing program directly, but this intermediate step will give us some extra flexibility.

Lets construct our autorun.inf file.  The easiest way is to use notepad.
From the Start Menu - Start - Run - type Notepad and hit OK.


Once in notepad we construct a pretty simple file.  Just type the following two lines and save it as autorun.inf.
This will tell the autorun function to execute the autorun.bat file.


Save the file as autorun.inf and put it in a directory by itself for now.
I suggest creating a "working" directory that we will use to place all the files that will later be burned onto the CD ROM.

Batch Files


Batch files go all the way back to DOS even before windows existed as an operating system.  Batch files are simple text files that when executed issue commands. 

For our autorun picture disc we will put all of our commands into a batch file.  This leaves us with only one file that we need to modify when we create our picture disk.  Also herein lies our flexibility.  If for some reason the autorun function is disabled the user can just get to the CD/DVD Drive and double click on the batch file to execute the commands to start the picture viewer.  (Always have a backup plan)
Plus we will be able to test our commands and directory structure before burning it to the disc.  (saves us from making coasters)

As with our autorun.inf file, we will use Notepad to create our batch file.
Type in the following commands and save the file as autorun.bat to the same working directory as you did the autorun.inf file.

There are a couple things going on here that require an explanation.
The first line gives the command to change to the pictures directory, then the second line executes the PiX.exe picture viewing program.
As this runs you will see that there is a command window open, so the last command cleans up by closing the command window.

Now that you have your autorun.inf and your autorun.bat file complete we can discuss the directory structure you will need to set up in order for this whole thing to work.

Directory Structure

Here you can see that I have created a test directory.  In it I have placed my autorun.bat and my autorun.inf files.
This will be the root directory in the Picture Disk.
Here you can see that I have also created a pictures directory and put all my pictures in it along with the PiX.exe viewer program.

The Picture Viewing Program

There are many programs available to view pictures.  I have searched far and wide and have come upon the Pix Viewer.
It is a freeware program and can be downloaded at http://codershole.com/
The author of the program created it just for this purpose.  It is a small standalone executable file that views .jpg .gif and .bmp files.
You will need to make sure that all of the pictures you place in your pictured directory have the correct extensions.  You won't get any errors, the pictures just will not be displayed.


The Basics of PiX Viewer


When the PiX viewer starts you can see that the pictures in your directory are displayed on the left hand side of the application window.
You can go through each picture individually by clicking on the file name. 
If you so choose you can have a full screen slide show.  Below the image there is a button "Start Slide Show".  Just press it to start the full-screen show.  But first put in a time (in seconds) for each of the pictures to be displayed.
That's all there is to it! 

Putting it all Together

We now have everything we need:

We also understand the directory structure that is necessary for it all to work.

  1. Create your Test Directory -
  2. Place the Autorun.inf and the Autorun.bat file in the "root directory"
  3. Create the pictures directory
  4. Place your pictures and the PiX.exe file into the pictures directory.
Your layout should look just like the image below.


I suggest that you now "test" your setup by double clicking on the autorun.bat file.
This should fire up the PiX viewer and you can verify that you see all your images, and can test the slide show function.
Of course the only thing not tested here is your autorun.inf file, but because there were only two lines I am hoping that you got it right.

For the purposes of this tutorial I will assume that you have the understanding to operate your CD/DVD burning software and are able to burn this directory structure to a disc.  A future tutorial may deal with the logistics of burning a disk.  For now if you can't do it, just ask a friend.

Conclusion

I hope you found this tutorial helpful.
Please give me feedback on any questions or suggestions you may have. 
These tutorials are always a work in progress, and your help is appreciated.
loren@insidethecomputer.com

If you would like please visit my website - http://www.theteachingbox.com
I have made a small zip file available in my download area with all this information as well as copies of the autorun.inf and autorun.bat files we have discussed.
I will also include the PiX viewer executable file.

TeachingBox.jpg