Menu
Is it possible to automatically launch an application from a USB flash drive (bypassing windows prompt asking user what he wants to do)? on windows XP or vista.
I looked into 'autorun.inf' and 'open' entry seems to work only for CD drives for Windows XP SP2+ and Vista. Is it possible to launch program automatically on all windows versions?
I don't care if autorun is disabled by user in Windows settings.
Xenph Yan54.2k1515 gold badges4242 silver badges5454 bronze badges
SumrakSumrak2,02266 gold badges2525 silver badges3636 bronze badges
5 Answers
First of all, some people choose to disable autorun for security reasons; but Windows computers up to Vista have it enabled. Edit: Apparently the functionality was removed from Windows 7 onwards.
Put a file named autorun.inf in the root of your USB flash drive. This is what's in mine:
What it does: when you insert this disk, starts
PStart.exe
On older computers, the program specified in
Open=
will launch automatically.On most modern computers (Windows XP SP2+, Vista), dialog 'what do you want to do' will be displayed (for security reasons), but what you have in
autorun.inf
will display as the selected default, with Icon=
as icon and Action=
as description. If you want to launch it, just click the 'OK' button in the dialog.So, although I'm not aware of any way to start the application (e.g. PStart) immediately, it is possible to insert flash disk with this configuration and start application by clicking OK.
Tested on different computers, running Windows XP without a SP, also on Windows XP sp 1, sp2, sp3, and on various Vistas (not sure which types, but should work all the way from Vista Home Basic to Vista Enterprise Super-Mega-Premium-Extended Edition) and 'Windows 7'. Also works on Windows 2000 (although autorun on Win2000 for removable drives is not enabled in default configuration).
Note that some applications, in addition, may trigger the 'unknown/unsigned exacutable' security dialog, as if you opened them manually.
Edit: For more details, see also:
Autoplay in Windows XP: Automatically Detect and React to New Devices on a System
PiskvorPiskvorAutoplay in Windows XP: Automatically Detect and React to New Devices on a System
73.3k4141 gold badges159159 silver badges210210 bronze badges
I've had something set up on my USB keys for a while now. Using the autorun.inf file will work, depending on your system's settings for autorun. Some disable it altogether after that little debacle with Sony a couple years back installing rootkit software on peoples' machines. Here're a couple articles to check out.
Have Your Lost USB Drive Ask For Help (1) or 2
AminM1,13922 gold badges2323 silver badges3838 bronze badges
BobCBobC32211 gold badge44 silver badges2020 bronze badges
Ck2 console commands religion list. you need UseAutoplay to let this work on usb.
and if you take ShellExecute instead of open you can also open scripts/documents/..
berlindevberlindev
there are also U3 usb sticks arround, they will be reconised as cdrom drives in windows.if you put an a autorun.inf on one of those, it will get executed without the user being questioned.
regards morla
morla
I found the solution in this blog
It worked fine for me
(the article explains how to do it with AutoIT, a 3rd party app that must be installed on the host computer)
AminM1,13922 gold badges2323 silver badges3838 bronze badges
ihebihebihebiheb1,09011 gold badge2222 silver badges3232 bronze badges
Not the answer you're looking for? Browse other questions tagged usbautorun or ask your own question.
An autorun.inf file is a text file that can be used by the AutoRun and AutoPlay components of Microsoft Windowsoperating systems. For the file to be discovered and used by these component, it must be located in the root directory of a volume. As Windows has a case-insensitive view of filenames, the autorun.inf file can be stored as AutoRun.inf or Autorun.INF or any other case combination.
The AutoRun component was introduced in Windows 95 as a way of reducing support costs. AutoRun enabled application CD-ROMs to automatically launch a program which could then guide the user through the installation process. By placing settings in an autorun.inf file, manufacturers could decide what actions were taken when their CD-ROM was inserted. The simplest autorun.inf files have just two settings: one specifying an icon to represent the CD in Windows Explorer (or 'My Computer') and one specifying which application to run.
Extra settings have been added in successive versions of Windows to support AutoPlay and other new features.
- 1The autorun.inf file
- 3Sections
The autorun.inf file[edit]
autorun.inf is an ASCII text file located in the root folder of a CD-ROM or other volume device medium (See AutoPlay device types). The structure is that of a classic Windows .ini file, containing information and commands as 'key=value' pairs, grouped into sections.[1] These keys specify:
- The name and the location of a program to call when the medium is inserted (the 'AutoRun task').
- The name of a file that contains an icon that represents the medium in Explorer (instead of the standard drive icon).
- Commands for the menu that appears when the user right-clicks the drive icon.
- The default command that runs when the user double-clicks the drive icon.
- Settings that alter AutoPlay detection routines or search parameters.
- Settings that indicate the presence of drivers.
Abuse[edit]
Autorun.inf has been used to execute a malicious program automatically, without the user knowing.[2][3][4][5] This functionality was removed in Windows 7 and a patch for Windows XP and Vista was released on August 25, 2009 and included in Microsoft Automatic Updates on February 8, 2011.[3][5][6][7]
Inf handling[edit]
The mere existence of an autorun.inf file on a medium does not mean that Windows will automatically read it or use its settings. How an inf file is handled depends on the version of Windows in use, the volume drive type and certain Registry settings.
Assuming Registry settings allow, the following autorun.inf handling takes place:
- Windows versions prior to Windows XP
- On any drive type, the autorun.inf is read, parsed and instructions followed immediately and silently.[8]
- The 'AutoRun task' is the application specified by the
open
orshellexecute
keys. If an AutoRun task is specified it is executed immediately without user interaction.
- Windows XP, prior to Service Pack 2
- Introduction of AutoPlay.
- Drives of type DRIVE_CDROM invoke AutoPlay if no autorun.inf file is found.
- Drives of type DRIVE_REMOVABLE do not use the autorun.inf file.[1] Any discovered removable media are handled by AutoPlay.
- All other handling is as before.
- XP Service Pack 2 and up (includes Vista)
- Drives of type DRIVE_FIXED are now handled by AutoPlay. Any specified AutoRun task appears as an option within the AutoPlay dialog together with any text specified by the optional
action
key.[9] - Drives of type DRIVE_REMOVABLE now use autorun.inf but continue to be handled by AutoPlay. Any specified AutoRun task needs to be paired with the mandatory
action
key to appear as an option within the AutoPlay dialog. Otherwise the AutoRun task is omitted.[9] - All other handling is as before.
- Vista and later
- The AutoRun task is no longer automatically and silently executed on any drive type. All volumes are handled by AutoPlay which, by default, will present an appropriate dialog to the user.
- Windows 7, Windows 8, Windows 8.1, Windows 10
- For all drive types, except DRIVE_CDROM, the only keys available in the [autorun] section are
label
andicon
. Any other keys in this section will be ignored. Thus only CD and DVD media types can specify an AutoRun task or affect double-click and right-click behaviour.[9][10] - There is a patch available, KB971029 for Windows XP and later, that will change AutoRun functionality to this behaviour.[11]
A simple example[edit]
This simple autorun.inf file specifies setup.exe as the application to run when AutoRun is activated. The first icon stored within setup.exe itself will represent the drive in Explorer:
Sections[edit]
Following are the sections and keys allowed in a valid autorun.inf.[9] There also exist architecture specific section types for systems such as Windows NT 4 running on RISC. However these are long outdated and not described here.
[autorun][edit]
The autorun section contains the default AutoRun commands. An autorun.inf file must contain this section to be valid. Keys allowed are:
- action=text
- action=@[filepath]filename,-resourceID
- Windows XP SP2 or later; drives of type DRIVE_REMOVABLE and DRIVE_FIXED
- Specifies text used in the AutoPlay dialog to represent the program specified in the
open
orshellexecute
keys. The text is expressed as either text or as a resource reference. Theicon
is displayed next to the text. This item is always first in the AutoPlay dialog and is always selected by default. - If the (action) key does not appear on drives of type:
- DRIVE_REMOVABLE
- the AutoPlay dialog appears but without additional menu items. Essentially, the AutoRun task is omitted. This makes the action key mandatory for drives of this type.
- DRIVE_FIXED
- default text is created and used in the AutoPlay dialog.
- On all other drive types the key is ignored.
- icon=iconfilename[,index]
- The name of a file resource containing an icon. This icon replaces the standard drive icon in Windows Explorer. This file must be in the same directory as the file specified by the
open
key. - label=text
- Specifies a text label representing the drive in Windows Explorer.
- open=[exepath]exefile [param1 [param2 ..]]
- Specifies the path, file name and optional parameters to the application that AutoRun launches when a user inserts a disc in the drive. It is the CreateProcess function that is called by AutoRun. Note that if the application name includes spaces the path should be enclosed in double quote, e.g. open='spread sheets.exe'
- shellexecute=[filepath]filename [param1 [param2 ..]]
- Windows 2000, Windows ME or later
- Similar to open, but using file association information to run the application. The file name can therefore be an executable or a data file. It is the ShellExecuteEx function that is called by AutoRun.
- UseAutoPlay=1
- Windows XP or later; drives of type DRIVE_CDROM
- Use AutoPlay rather than AutoRun with CD-ROMs. The action taken on CD-ROM insertion will depend on the version of Windows being used.
- On versions of Windows earlier than XP, this key has no effect and actions specified by
open
orshellexecute
are performed. - On Windows XP and later, the user will be presented with the AutoPlay dialog and any actions specified by
open
orshellexecute
are ignored. - shellverbcommand=[exepath]exefile [param1 [param2 ..]]
- Adds a custom command to the drive's shortcut menu. verb is a string with no embedded spaces. verb is also the text that will appear in the shortcut menu unless specifically altered to some other text. See below for an example.
- shellverb=menu text
- Optionally specify the text displayed in the shortcut menu for the verb above. Use an ampersand (&) to select a hotkey for the menu. See below for an example.
- shell=verb
- Defines the menu command referred to by
shellverb
as the default command in the shortcut menu. The default command is the command executed when the drive icon is double-clicked. If missing, the default menu item will be 'AutoPlay', which launches the application specified by theopen
entry. - Example:
[Content][edit]
- Windows Vista or later
The Content section allows authors to communicate the type and intent of content to AutoPlay without AutoPlay having to examine the media.
Valid keys are:
MusicFiles
, PictureFiles
, VideoFiles
. Each key can be set to indicate true or false values and values are not case sensitive.- true or (1, y, yes, t)
- display the handlers associated with that content type
- false or (0, n, no, f)
- do not display the handlers associated with that content type
Example:
[ExclusiveContentPaths][edit]
- Windows Vista or later
Limits AutoPlay's content search to only those folders listed, and their subfolders. The folder names are always taken as absolute paths (a path from the root directory of the media) whether or not a leading slash is used.
Example:
[IgnoreContentPaths][edit]
- Windows Vista or later
AutoPlay's content search system will not scan the folders listed, nor their subfolders. IgnoreContentPaths takes precedence over ExclusiveContentPaths so if a path given in a [IgnoreContentPaths] section is a subfolder of a path given in an [ExclusiveContentPaths] section it is still ignored.
Example:
[DeviceInstall][edit]
- Only Windows XP[9]
This section is used to indicate where driver files may be located. This prevents a lengthy search through the entire contents of a CD-ROM. Windows XP will fully search:
- floppy disks in drives A or B
- CD/DVD media less than 1 GB in size.
without this section present. All other media should include this section to have Windows XP autodetect any drivers stored on that media.
The section is not used with AutoRun or AutoPlay and is only referred to during a driver installation phase. The only valid key is:
which lists a path Windows will search for driver files. All subdirectories of that path are also searched. Multiple key entries are allowed.
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.Example:
References[edit]
- ^ ab'Creating an AutoRun-Enabled Application'. MSDN Library. Microsoft.
- ^Conficker § Operation
- ^ abBureau), Robert McMillan and IDG News Service (San Francisco. 'After CERT Warning, Microsoft Delivers AutoRun Fix'.
- ^Constantin, Lucian. 'Security researchers discover link between Stuxnet and Flame'.
- ^ ab'AutoPlay Windows 7 behavior backported'.
- ^Gonsalves, Antone. 'Security firms warn of spreading Windows AutoRun malware'.
- ^'Microsoft finally says adios to Autorun'.
- ^'How to Test autorun.inf Files'. Knowledge Base. Microsoft.
- ^ abcde'Autorun.inf Entries'. MSDN Library. Microsoft.
- ^'Improvements to AutoPlay'. Engineering Windows 7 blog. Microsoft.
- ^'Update to the AutoPlay functionality in Windows'. Knowledge Base. Microsoft.
External links[edit]
Retrieved from 'https://en.wikipedia.org/w/index.php?title=Autorun.inf&oldid=899540056'
-->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
- ActionTextText 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.
- filepathA 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.
- filenameA string that contains the binary file's name.
- resourceIDCars are not licensed, but faithfully reflect the actual counterparts.In addition, each of them can be subjected to our simple visual tuning, reducing the color of the car body and wheels.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
- CustomEventNameA 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.
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
- iconfilenameName 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
- LabelTextA 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
- exefileFully 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.
Fondos de pantallas cristianos hd en. 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'.
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
- filepathA 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.
- filenameA 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.
- paramxContains 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.
Parameters
- verbThe 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
Can Windows Xp Run Autorun Windows 7
- verbThe 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.exeThe path and file name of the application that performs the action.
- MenuTextThis 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
- directorypathA 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.
Portable apps—self-contained executables that can be moved onto flash drives and run without installation—are popular tools for anyone who has to work on multiple Windows machines. If you want to make your workflow even faster, you can add an “auto-run” file that automatically opens the program as soon as you plug in the drive.
RELATED:What Is a “Portable” App, and Why Does It Matter?
Unfortunately, starting with Windows 7, Microsoft restricted the autorun function for security purposes. There’s no practical way to get it back on every new machine, but it’s possible to do so on computers you have access to on a regular basis. First, you’ll need a small, third-party tool that monitors new USB drives for the autorun instruction. Then, you’ll need to create a simple autorun script file that sits on the USB drive and designates what program to run when you insert the drive.
Step One: Install APO USB Autorun on Your Windows PC
APO USB Autorun is a program that monitors USB drives as they’re plugged in, looking for the legacy autorun.inf script file and launching any programs directed within. Download it from Softpedia here, then double-click the installer file and install it like any other program.
After installation, whenever you connect a USB drive, you should see a window pop-up like the one below, asking if you want to run the program you’ve designated to run automatically (and we’ll talk more about how to do that part in a bit).
Just click the “Run” button to run the program and, optionally, disable the “Always ask before opening this file” option so that you aren’t bothered with this warning the next time you insert the drive.
Unfortunately, you’ll need to install APO USB Autorun on each Windows 7 or later PC that you want to autorun your USB drives. That makes it not so useful for drives you carry around to lots of different PCs, but it can be really helpful if you often work on the same computer.
Step Two: Set Up the USB Drive
In order to autorun a program, the USB drive needs to contain two things: the program you want to run and an autorun script file that points to that program.
Go ahead and copy the portable executable for the program to your USB drive. That’s the easy part.
To create the autorun script file, open up Notepad (or whatever text editor you prefer). Type (or copy and paste) the following text into the Notepad window, complete with line breaks.
Replace the “YOURAPP” text with the file name of the application you’re trying to start. I’m using the portable version of the Lynx browser for this demonstration, so my commands read like this:
Next, save the file to your USB drive with the name “autorun.inf” and make sure that you select “All Files (*.*)” in the “Save as type” field. That way, Notepad won’t add an additional “.txt” extension to the end of your file name.
The root folder of your USB drive should now contain the program’s executable file and the autorun.inf file you just created.
You can place other files and folders in the drive, of course, but make sure to keep those two items in the root directory.
Now, with APO USB Autorun running and your USB drive properly configured, your program should run automatically whenever you connect the USB drive to your PC.
Image credit: Amazon
READ NEXT- › How to Speed Up Your PlayStation 4’s Downloads
- › How to Disable the Login Screen’s Background Blur on Windows 10
- › How to Use All Linux’s Search Commands
- › How to See All Your Saved Wi-Fi Passwords on Windows 10
- › How Do Bone Conduction Headphones Work?