Wednesday, January 16, 2008

All about autorun ini files

Extending the functionality of Autorun.inf

There are also some extensions to the autorun.inf file you can use that will put shortcutson the right-click menu of CD's icon. For example, add this to your autorun.inf (below the icon= line):

shell\read\command=notepad.exe readme.txt
shell\read=Read M&e First

The CD icon right-click menu will have a new item, “Read Me First” (with E as a hotkey)that launches Notepad with the readme.txt from the CD loaded. The ampersand (&)character in the second line denotes the hotkey letter, which is underlined in the menu. So Rea&d Me First would make ‘D’ the hotkey, and the menu item would appear as “Read Me First”. If you use hot keys (you don’t have to), do ensure that the letter you wish to use isn’t already assigned to a standard Windows context menu choice, such as Copy, Properties and Rename. The first listed menu entry for any hotkey gets executed. As for the open command, you can give a path to the file you wish to open (note as for the‘open=’ and ‘icon=’ lines, no leading backslash is used):

shell\read\command=notepad.exe mydocs\readme.txt

You can add more than one such context menu shortcut by tweaking the ‘read’ verb:

shell\read1\command=notepad.exe readme.txt
shell\read1=Read M&e First
shell\read2\command=notepad.exe EULA.txt
shell\read2=Read My E&ULA

This adds “Read Me First” and “Read My EULA” items to the CD’s right-click context menu. Items are added in the order they are in the autorun.inf. For more use ‘read3’, ‘read4’ etc. You may be aware that as from version 4.x, Adobe Reader can also be run from CD. This means that you can provide the user with a way of opening the Browser's "Quick Start guide" which is provided in PDF format - without assuming the user has Acrobat installed.

shell\read1\command=notepad.exe readme.txt
shell\read1=Read M&e First
shell\readit2\command=acrobat\reader\acrord32.exe
portbrws\qsg.pdf
shell\readit2=Read Quick Start Guide (PDF)

Note: the shell\readit2\command line is typed all as one line with a space between the 2 paths.


Hacking Techniques