JSI Tip 5264. How do I change the double-click action, the default, for a file type, using Windows XP?

Jerold Schulman

May 2, 2002

1 Min Read
ITPro Today logo in a gray background | ITPro Today

The default action that happens when you double-click a file in Windows XP Explorer, or My Computer, is defined by the files extension. All files of the same extension have the same default action.

NOTE: The most common default action is Open, which launches the associated program anduses the file you double-clicked.

NOTE: To determine the default action of a file type, right-click a file with that extension. The default action is in boldface type.

You may wish to change the default action. You can change the default of a batch file (.bat extension) from Open to Edit, which will prevent the file from accidentallyrunning when you double-click it.

To change the default action:

1. Control Panel / [Appearance and Themes] / Folder Options.

2. Select the File Types tab.

NOTE: If you can't find the extension, see Using the Registry on this page.

3. Press the file extension for which you want to change the default action.

4. Press the Advanced button. 

5. Press the command that you want to make the default action and press the Set Default button.

6. Press OK and then exit the dialog.

Using the Registry

To set the default action, using the registry:

1. Open a CMD prompt and type:

assoc .

Example: assoc .bat

This will return:

.bat=batfile

2. Use regedit.exe to navigate to:

HKEY_LOCAL_MACHINESOFTWAREClassesbatfileshell

where batfile is the string returned from step 1.

3. Double-click the (Default) Value Name and set the data value of this string to the name of the default action.

Example: Set the (Default) string to edit.

4. Exit the Registry Editor.

NOTE: You can also create a .reg to set the default action, and then run it, regedit /s filename.reg:

REGEDIT4

[HKEY_LOCAL_MACHINESOFTWAREClassesbatfileshell]
@="edit"



Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like