How to create your own Autorun

In this blog post I will guide you through the processes to create your very own autorun file.

If you haven’t already, you can read my previous blog post USB Autorun logging C++ code

 

What is Autorun?

Autorun.cfg or Autorun.inf is a configuration file which is run whenever you plug an USB device into your computer.

This file holds information such as name, icon, menu name and more.

 

How do I make my own Autorun

Open any text editor of your choice and start with

[autorun]

 

Save the file as autorun.cfg or autofun.inf

 

Now we have a fully functional autorun file, though it does not do anything yet. Now we need to give it some commands to execute whenever this file is being run.

 

LABEL

Example: label=This is the name of my device

This will set the name of your device

 

ICON

Example: icon=iconFileName.ico

This will set the icon of your device

 

OPEN

Example: open=pathToFile.fileType

When the device is plugged in, the given file will automatically run.

Notice: This feature is suppressed in Windows for security reasons.

 

SHELLEXECUTE

Example: shellexecute=pathToFile.fileType

Notice: This feature is suppressed in Windows for security reasons.

 

ACTION

Example: action=Click to play

Text on a button which when clicked will execute either OPEN or SHELLEXECUTE

Notice: This feature is suppressed in Windows for security reasons.

 

Save and put it on the root of your USB Device

When you have finished creating your autorun file, simply save it as autorun.cfg or autorun.inf and put it in the root of your USB device and un-plug your device and then plug in your device.

Now your device should show up with the commands you have given it.

 

A more detailed list of autorun commands can be found here

http://msdn.microsoft.com/en-us/library/aa969327.aspx