Export (0) Print
Expand All

Managing Applications on Storage Cards with Autorun.exe

Send Feedback

The autorun feature, which is part of the OS, enables Windows Mobile software to:

  • Detect a storage card that has been inserted into a Windows Mobile-based device and automatically load a specified application from the storage card into active memory
  • Detect removal of the storage card and to instruct the application to perform cleanup and to remove itself from active memory

Renaming any executable file to Autorun.exe will make it launch automatically when the card is inserted into the device. The autorun.exe file must be in an appropriately named folder that coincides with the processor in the device. To take advantage of this feature, add the following directory structure and file to a storage card:

Note   The folder name 2577 signifies an ARM processor. This is the typical processor for a Pocket PC running Windows Mobile software version 2002 or later. See SHGetAutoRunPath for a list of applicable folder names for other processor models.

When a user inserts a storage card, the Windows Mobile software:

  1. Searches the root directory of the card for a directory named with the appropriate processor code for that device
  2. Searches this directory for the autorun.exe file and loads this file to the \Windows directory in main memory on the device
  3. The shell invokes the copy of autorun.exe on the device, passing it the command-line argument "install"

When the user removes the card, the shell invokes autorun.exe, passing it the command-line argument "uninstall". The software also detects whether a card is inserted, removed, or swapped while power is off and takes appropriate action as soon as the device is turned on.

Programmers can determine the source directory for the autorun.exe file by using the SHGetAutoRunPath function. A storage card must be inserted for this function to succeed, although autorun.exe does not need to be present on the storage card. This function will create the directory path based on the present processor and return it as a string variable.


For example, a game developer can store game binaries and data files on a storage card. The developer can then design the autorun.exe file that adds registry settings and loads necessary files when the storage card is inserted into the device and removes these settings and files when the card is removed. If the game needs to retrieve its home path for whatever reason, the SHGetAutoRunPath function returns this in a string variable.

In an enterprise application, an autorun.exe can be used to deploy a custom software application and data to a large number of devices. Updates to the application can be distributed to remote employees on inexpensive, low-capacity storage cards that perform automatic and trouble-free installation when inserted into the devices.

If users must cold boot or replace their devices, they can simply insert a preprogrammed storage card that contains the application and data and turn their device on. The autorun feature will then launch the autorun.exe application and perform the programmed actions.

See Also

File and Application Management Reference | How to: Enumerate Storage Cards | How to: List and Locate Storage Card Files

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.

© 2015 Microsoft