February 6, 2001
By Karen Kenworthy
IN THIS ISSUE
It all started a few of years ago when Windows Magazine asked me to make a few CDs. Every few months I selected the best freeware and shareware programs on the Internet and placed them on a custom CD-ROM. The magazine then duplicated the CD thousands of times, and sent a copy to each new subscriber. Who knows, you might even have received one.
Back then, handmade CDs were expensive. My first CD-R drive cost $1,200. And a 1 GB hard disk drive fast enough to keep up with this 1x recorder cost another $1,200. Recording software was a bargain at $500. And blank CDs cost about $10 each, in quantity. You sure didn't want to make many "coasters" at that price!
Today, most PCs come equipped with drives that can make CDs. And computers that don't can be upgraded for little more than $100. Most drives come with free CD recording software. Blank CDs now sell for less than $1 each.
Sigh. I was born five years too early.
Putting our favorite programs and files on CD is easy, thanks to today's recording software. But how can we make a program run automatically each time the CD is inserted into a drive? Wouldn't it be nice if your favorite Backup and Restore program started each time you inserted a backup CD? Why shouldn't your MP3 player run when you insert a CD full of music files? How about having a photo viewer launch when you insert your family photo album on CD?
Commercial software companies do this all the time. Insert a CD, and its Setup program runs. The trick is a little text file named Autorun.inf. Stored in the CD's root directory, it determines which program runs when the CD is inserted, and a whole lot more.
To run a program named Setup.exe automatically each time a CD is inserted, an Autorun.inf file should contain these lines:
If the program needs any parameters or switch settings, you can add those after the program's name. For example, to automatically launch a program named Viewer.exe, and pass it the name of a picture file, the Autorun.inf file might consist of these lines:
If you look closely at these two examples, you'll notice a pattern. Each Autorun.inf file starts with "[Autorun]" on the first line. This line seems redundant, given the file's name. But it's required nevertheless.
Next comes a line that begins with "open=" followed by the program that should run automatically. Normally, the program resides in the CD's root directory, so no path is specified. After the program's name comes any parameters the program may need.
These are the two most common Autorun.inf lines. But there are other lines the file might contain. Other lines allow you to specify the icon used to represent the disc in My Computer, and the text that appears below that icon. Other lines allow you to add lines to the "context" menu that's displayed when a user right- clicks their mouse over that icon.
You can create your own Autorun.inf file. All you need is a text editor like Notepad and an intimate knowledge of Autorun.inf's quirky syntax. But hey, this is Power Tools. Shouldn't there be a nifty little program that asks us a few simple questions, and creates an Autorun.inf file for us?
Of course. And there is. It's called the Winmag.com Autorun.inf Editor, and it's making its debut today.
The main window of the Autorun.inf Editor is divided into four sections. The first allows you to specify what program, if any, should be automatically run each time the CD is inserted. You can also specify any parameters, such as a file name, that should be passed to this program.
The second section of the main window allows you to specify the icon used to represent the disc, and the text that appears beneath that icon. The icon can be stored in a Windows Icon file (a file with a filename extension of .ico), or any Windows .EXE or .DLL file. If the .EXE and .DLL file contains more than one icon, the Editor allows you to select which of the file's icons should be displayed.
Next comes the section of the Editor's main window where the disc's context menu is described. This is the little menu that pops up each time a user clicks their right mouse button over the disc's icon. By default, this menu contains choices such as Open, Search, Eject, and Properties. If the Autorun.inf file specifies a program to run automatically, the menu will contain an "Autoplay" choice too.
But you can add additional choices if you like. A software disc might contain a menu choice to Uninstall the software, for example. Or there might be a "Read Me" choice that launches a text viewer and displays a documentation file. Other choices could allow a person to register her software, or even visit a support Web site.
To create a context menu entry, the Autorun.inf Editor asks for three things: the word or words that appear in the menu, the program to run when the choice is selected, and any parameters that should be passed to the program. The Editor also lets you control the order in which the context menu choices appear.
The fourth section of the Editor's main window allows you to test your Autorun.inf file before saving it. If you've selected an icon for your disc, it's displayed here, along with any text label you've specified. You can also right-click on this test icon and see the context menu choices you've defined. Select one of these menu choices, and the Editor will display the command that will be executed.
Saving to Disk
Once your Autorun.inf file is just right, it's time to save it to disk. Just click the Editor's Save button. You'll then see the program's Save dialog, where you can select the directory where the new Autorun.inf file will be stored.
The Save dialog also offers to copy the files mentioned in the Autorun.inf file to the same directory. Separate options let you order the Editor to copy the program that runs automatically when the disc is inserted, copy the file containing the disc's icon, and copy the programs run when context menu choices are selected.
To activate your new Autorun.inf file, just store it, and the files it references, in the root directory your next CD. Insert the new CD in a drive near you, and Windows will do the rest!
If you'd like to give the new Autorun.inf Editor a try, you can download a copy from the program's home page, https://www.karenware.com/powertools/ptautorun. The program's Visual Basic source code is available there too. As always, both are free.
And if you take a break from making CDs, look for me on the 'net. I'll be the one trying to unload that old CD burner. If you see me there, be sure to wave and say "Hi!"
More than 6000 downloads monthly
Received $24.61 this month* — Thanks!
March Revenue* $24.61
*Licenses + Donations - PayPal Fees
Jan $56 Dec $349 Nov $546 Oct $253 Sep $232 Aug $189 Jul $379 Jun $188 May $484 Apr $212 Mar $519 Feb $89 Jan23 $462 Dec22 $1088 Nov22 $151 Oct22 $133 USD — Thanks again!