Creating and using autorun USB
- Do you want to have control over automatically starting applications? This is the PRO key for Autorun Manager.-This app itself won't open, this just unlocks the free Autorun Manager app.
- Do you want to have control over automatically starting applications? This is the PRO key for Autorun Manager.-This app itself won't open, this just unlocks the free Autorun Manager app.
AutoRun Pro is an application created to help you design and export autorun interfaces for content that is available on discs and flash drives. With it you can create an interactive menu for any.
I decided to write this article for everyone who wants to get advice on how to create an autorun USB flash drive. If you're like most anyone these days, you have a USB stick that you use to take computer files from home to the office and back, rather than taking a laptop with you, which can be bothersome. A USB key is small and can hold gigabytes of data, which makes it perfect for anyone who wants to have computer files and applications always at hand.
As you know, when the USB drive is plugged into the port, an autorun USB dialog appears that prompts you to do certain operations: print images, run Windows Media Players, or open a folder. But what if you have a particular application on the USB drive and want it to be launched from the autorun USB dialog? There are two answers to the question. Firstly, you can put autorun.inf into the root of the USB drive and edit its commands to get the app started when the USB key is plugged. Secondly, you may want to create a fully-fledged autorun USB menu, which can be used to run a presentation, portfolio, etc. Below I am going to tell you how to make use of both solutions.
1. How To Create a Basic autorun USB
To get started, we need a USB flash drive, Notepad (other editors are not recommended as they add extra coding), an application you wish to run when the stick is plugged into the USB port.
Now follow these steps:
- Run 'Notepad'
- Type in:
[Autorun]
Open=MyApp.exe
Action=Start MyApp
Label=My Portable PC
Icon=MyApp.exe - Save the file as autorun.inf in the root of the USB flash drive
In this sample, the Action command will place the text 'Start MyApp' in the autoplay USB dialog. The item will be selected by default. Next to the text, the icon specified by the Icon command is shown. And when the user chooses the selected item, the program file specified by the Open command is launched.
Next time you plug in the USB key into the port, the specified program starts automatically.
2. How To Create autorun USB menu
Sometimes we may need to make an autorun USB menu. For example, as an artist you may want to assemble a portfolio of your designs under a nice front-end and show it to prospective clients from the autorun USB stick. Or, you may want to create a business presentation or lecture that could also start from the USB key automatically. Companies may want to create an autorun USB with marketing materials and distribute to partners and clients.
If you're looking for an application to create a fully-fledged autorun USB menu for a USB flash drive, I recommend you take a look at Autoplay Menu Designer. The program is very intuitive and friendly in that you do not have to be a design expert to make a great looking front-end for a presentation or portfolio on a USB flash drive. The program offers a wizard-driven interface and a set of professionally-looking templates, letting you jumpstart your autorun USB menu with a minimal amount of efforts. You just run the program and begin.
Once it's done, you are presented with the selected menu template in the editing window of the program. It's time to edit.
The program offers a variety of editing features. I found myself spending quite some time playing around with all of them. You can add text blocks and enter your annotations, add buttons, shapes, lines and other objects just by dragging them onto the menu screens with the mouse. To add navigation and interactivity to the menu, you should add links and hotspots to objects, as well as interactive actions that automatically trigger when the mouse is over the item or the item is clicked. For example, you can set an image to show a tooltip when the mouse is over or set a button to play a sound and open a document when the button is clicked. There are no limitations on how elaborate the interactivity can be, so you can make it anything you imagine.
At any moment, you can enter the preview mode and see how the menu works. If you are not happy with the changes, you can always go back and keep on editing until you get what you want.
The last step is to package the menu files and put them onto the USB key. Making an autorun USB menu doesn't get any easier than this. When the USB stick is plugged in, the autorun USB menu pops up on autopilot.
3. Autorun USB in Windows 7 and higher
About an Autorun USB in Windows 7 and higher read here: 'Articles -> Autorun USB in Windows 7 and higher'
-->This topic is a reference for the entries that can be used in an Autorun.inf file. An entry consists of a key and a value.
- [AutoRun] Keys
- [DeviceInstall] Keys
[AutoRun] Keys
action
The action entry specifies the text that is used in the Autoplay dialog for the handler representing the program specified in the open or shellexecute entry in the media's Autorun.inf file. The value can be expressed as either text or as a resource stored in a binary.
Parameters
ActionText
Text that is used in the Autoplay dialog for the handler representing the program specified in the open or shellexecute entry in the media's Autorun.inf file.
filepath
A string that contains the fully qualified path of the directory that contains the binary file containing the string. If no path is specified, the file must be in the drive's root directory.
filename
A string that contains the binary file's name.
resourceID
The ID of the string within the binary file.
Remarks
The action key is only used in Windows XP Service Pack 2 (SP2) or later. It is only supported for drives of type DRIVE_REMOVABLE and DRIVE_FIXED. In the case of DRIVE_REMOVABLE, the action key is required. An action command in the Autorun.inf file of an audio CD or movie DVD is ignored, and these media continue to behave as in Windows XP Service Pack 1 (SP1) and earlier.
The string displayed in the Autoplay dialog is constructed by combining the text specified in the action entry with hard-coded text naming the provider, provided by the Shell. The icon is displayed next to it. This entry always appears as the first option in the Autoplay dialog and is selected by default. If the user accepts the option, the application specified by the open or shellexecute entry in the media's Autorun.inf file is launched. The Always do the selected action option is not available in this situation.
The action and icon keys together define the representation of the application that is seen by the end user in the Autoplay dialog. They should be composed in such a way that users can easily identify them. They should indicate the application to be run, the company that created it, and any associated branding.
For backward compatibility, the action entry is optional for devices of type DRIVE_FIXED. For this type, a default entry is used in the Autoplay dialog if no action entry is present in the Autorun.inf file.
The action entry is mandatory for devices of type DRIVE_REMOVABLE, which until now did not have Autorun.inf support. If no action entry is present, the Autoplay dialog is displayed but with no option to launch the additional content.
CustomEvent
The CustomEvent entry specifies a custom AutoPlay content event.
Parameters
CustomEventName
A text string containing the name of the AutoPlay content event. The name must be no more than 100 alphanumeric characters.
Remarks
You can include a custom event name in the Autorun.inf file of a volume. When AutoPlay prompts the user for an application to use with the volume, it displays only applications that have registered for the specified custom event name. For information on how you can register an application as a handler for your custom AutoPlay content event, see Auto-launching with AutoPlay or How to Register an Event Handler.
Autorun Pro Enterprise 15 Serial Key
The following example specifies the value 'MyContentOnArrival' as a new AutoPlay content event.
icon
The icon entry specifies an icon which represents the AutoRun-enabled drive in the Windows user interface.
Parameters
iconfilename
Name of an .ico, .bmp, .exe, or .dll file containing the icon information. If a file contains more than one icon, you must also specify zero-based index of the icon.
Remarks
The icon, together with the label, represents the AutoRun-enabled drive in the Windows user interface. For instance, in Windows Explorer, the drive is represented by this icon instead of the standard drive icon. The icon's file must be in the same directory as the file specified by the open command.
The following example specifies the second icon in the MyProg.exe file.
label
The label entry specifies a text label which represents the AutoRun-enabled drive in the Windows user interface.
Parameters
LabelText
A text string containing the label. It can contain spaces and should be no longer than 32 characters.
Note
It is possible to put a value in the LabelText parameter which exceeds 32 characters and receive no error message. However, the system only displays the first 32 characters. Any characters after the 32nd are truncated and not displayed. For example, if the LabelText is as follows: label='This CD is designed to be the ultimate music CD.' the following will be displayed, 'This CD is designed to be the ul'.
Remarks
The label, together with an icon, represents the AutoRun-enabled drive in the Windows user interface.
The following example specifies the value 'My Drive Label' as the drive's label.
open
The open entry specifies the path and file name of the application that AutoRun launches when a user inserts a disc in the drive.
Parameters
exefile
Fully qualified path of an executable file that runs when the CD is inserted. If only a file name is specified, it must be in drive's root directory. To locate the file in a subdirectory, you must specify a path. You can also include one or more command-line parameters to pass to the startup application.
UseAutoPlay
On Windows XP, the UseAutoPlay entry specifies that AutoPlay should be used instead of AutoRun.
On Windows Vista and later, this entry causes any actions specified for AutoRun (by using either the open or shellexecute entries) to be suppressed from the AutoPlay dialog. This entry has no effect on versions of Windows earlier than Windows XP.
On Windows 8 and later, specifying a value of 0 will disable autoplay for this device.
Parameters
To use this option, add an entry for UseAutoPlay to the Autorun.inf file and set the entry equal to 1. No other value is supported on versions of Windows earlier than Windows 8.
On Windows 8 and later, specify a value of 0 to disable autoplay for this device.
Remarks
Currently, UseAutoPlay is applicable only on Windows XP or later and only on a drive that GetDriveType determines to be of type DRIVE_CDROM.
When UseAutoPlay is used, any action specified by the open or shellexecute entries in Autorun.inf is ignored on Windows XP and omitted from the AutoPlay dialog on Windows Vista.
AutoRun is typically used to automatically run or load something contained on the inserted media, whereas AutoPlay presents a dialog that includes a list of relevant actions that may be taken and enables the user to choose which action to take. For more information about the difference between AutoRun and AutoPlay, see Creating an AutoRun-enabled CD-ROM Application and Using and Configuring AutoPlay, respectively.
Usage Example
A CD contains three files: Autorun.inf, Readme.txt, and Music.wma. Depending on the version of Windows in use and options specified in Autorun.inf, the CD may be handled by either AutoRun or AutoPlay when it is inserted (assuming AutoRun/AutoPlay is enabled for the drive into which the CD is inserted).
First, consider an Autorun.inf file with the following contents, noting that UseAutoPlay=1 is not specified:
The action taken by the Shell when this CD is inserted depends on the version of Windows in use:
- On Windows XP or earlier, this CD is handled by AutoRun when it is inserted. In this case, the shellexecute entry is read, and the Shell invokes the file handler associated with .txt files; typically this would open Readme.txt in Notepad.
- On Windows Vista, the presence of an Autorun.inf file with a shellexecute entry causes the media to be identified as AutoPlay type 'Software and games'. In this case the user is presented with an AutoPlay dialog that includes the action specified by the shellexecute entry (presented as 'Load Readme.txt' in the dialog), along with default actions associated with media of type 'Software and games'.
Autorun Pro Enterprise
To indicate that AutoPlay should be used rather than AutoRun on Windows XP, and that the action specified by the AutoRun shellexecute entry should be suppressed from the AutoPlay dialog on Windows Vista, insert UseAutoPlay into the Autorun.inf file as follows:
Once again, the action taken by the Shell when this CD is inserted depends on the version of Windows in use.
- On versions of Windows earlier than Windows XP, AutoRun is still used and the action specified by shellexecute is performed, as described previously. (Note that only AutoRun is available on versions of Windows earlier than Windows XP.)
- On Windows XP, the UseAutoPlay entry causes AutoPlay to be used in place of AutoRun. In this case, AutoPlay determines that the media contains a Windows Media Audio (.wma) file and categorizes the content as 'Music files'. The user is presented with an AutoPlay dialog containing registered handlers for the 'Music files' AutoPlay media type; the AutoRun shellexecute entry is ignored.
shellexecute
Version 5.0. The shellexecute entry specifies an application or data file that AutoRun will use to call ShellExecuteEx.
Parameters
filepath
A string that contains the fully qualified path of the directory that contains the data or executable file. If no path is specified, the file must be in the drive's root directory.
filename
A string that contains the file's name. If it is an executable file, it is launched. If it is a data file, it must be a member of a file type. ShellExecuteEx launches the default command associated with the file type.
paramx
Contains any additional parameters that should be passed to ShellExecuteEx.
Remarks
This entry is similar to open, but it allows you to use file association information to run the application.
shell
The shell entry specifies a default command for the drive's shortcut menu.
Autorun Pro Keys
Parameters
verb
The verb that corresponds to the menu command. The verb and its associated menu command must be defined in the Autorun.inf file with a shellverb entry.
Remarks
When a user right-clicks the drive icon, a shortcut menu appears. If an Autorun.inf file is present, the default shortcut menu command is taken from it. This command also executes when the user double-clicks the drive's icon.
To specify the default shortcut menu command, first define its verb, command string, and menu text with shellverb. Then use shell to make it the default shortcut menu command. Otherwise, the default menu item text will be 'AutoPlay', which launches the application specified by the open entry.
shellverb
The shellverb entry adds a custom command to the drive's shortcut menu.
Parameters
verb
The menu command's verb. The shellverbcommand entry associates the verb with an executable file. Verbs must not contain embedded spaces. By default, verb is the text that is displayed in the shortcut menu.
Filename.exe
The path and file name of the application that performs the action.
MenuText
This parameter specifies the text that is displayed in the shortcut menu. If it is omitted, verb is displayed. MenuText can be mixed-case and can contain spaces. You can set a shortcut key for the menu item by putting an ampersand (&) in front of the letter.
Remarks
When a user right-clicks the drive icon, a shortcut menu appears. Adding shellverb entries to the drive's Autorun.inf file allows you to add commands to this shortcut menu.
There are two parts to this entry, which must be on separate lines. The first part is shellverbcommand. It is required. It associates a string, called a verb, with the application to launch when the command runs. The second part is the **shell**verb entry. It is optional. You can include it to specify the text that displays in the shortcut menu.
To specify a default shortcut menu command, define the verb with shellverb, and make it the default command with the shell entry.
The following sample Autorun.inf fragment associates the readit verb with the command string 'Notepad abcreadme.txt'. The menu text is 'Read Me', and 'M' is defined as the item's shortcut key. When the user selects this command, the drive's abcreadme.txt file opens with Microsoft Notepad.
[Content] Keys
There are three file type keys: MusicFiles, PictureFiles, and VideoFiles.
If one of these contents is set to true through one the case-insensitive values 1, y, yes, t, or true, the Autoplay UI displays the handlers associated with that content type regardless of whether content of that type exists on the media.
If one of these contents is set to false through one the case-insensitive values 0, n, no, f, or false, the Autoplay UI does not display the handlers associated with that content type even if content of that type is detected on the media.
Use of this section is intended to allow content authors to communicate the intent of content to Autoplay. For instance, a CD can be categorized as containing only music content even though it also has pictures and videos and would otherwise be seen as having mixed content.
The [Content] section is only supported under Windows Vista and later.
[ExclusiveContentPaths] Keys
Folders listed in this section limit Autoplay to searching only those folders and their subfolders for content. They can be given with or without a leading backslash (). In either case they are taken as absolute paths from the root directory of the media. In the case of folders with spaces in their names, do not enclose them in quotes as the quotes are taken literally as part of the path.
Use of this section is intended to allow content authors both to communicate the intent of content to Autoplay and to shorten its scan time by limiting the scan to certain significant areas of the media.
The following are all valid paths
The [ExclusiveContentPaths] section is only supported under Windows Vista and later.
[IgnoreContentPaths] Keys
Folders listed in this section, and their subfolders, are ignored by Autoplay when searching a media for content. They can be given with or without a leading backslash (). In either case they are taken as absolute paths from the root directory of the media. In the case of folders with spaces in their names, do not enclose them in quotes as the quotes are taken literally as part of the path.
Paths in this section take precedence over paths in the [ExclusiveContentPaths] section. If a path given in [IgnoreContentPaths] is a subfolder of a path given in [ExclusiveContentPaths], it is still ignored.
Use of this section is intended to allow content authors both to communicate the intent of content to Autoplay and to shorten its scan time by limiting the scan to certain significant areas of the media.
The following are all valid paths
The [IgnoreContentPaths] section is only supported under Windows Vista and later.
[DeviceInstall] Keys
DriverPath
The DriverPath entry specifies a directory to search recursively for driver files. This command is used during a driver installation and is not part of an AutoRun operation. The [DeviceInstall] section is only supported under Windows XP.
Parameters
directorypath
A path to a directory that Windows searches for driver files, along with all of its subdirectories.
Remarks
Do not use drive letters in directorypath as they change from one computer to the next.
To search multiple directories, add a DriverPath entry for each directory as in this example.
If no DriverPath entry is provided in the [DeviceInstall] section or the DriverPath entry has no value, then that drive is skipped during a search for driver files.