How do I restore .bat files association with the system (make them run when double-clicked)?

I think you'll have to remove the .bat file association from the registry (using the regedit program).

According to this forum thread on LockerGnome, you need to remove registry settings underneath this key:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bat

You'll probably want to back up registry before doing this, just to be safe.


This registry key file will do it. Copy and paste to a text file called "restore.reg", and double click it to merge into the registry.

It will clear out any per-user setting you may have accidentlly created for .bat files, and restore the system defaults, including the .bat <-> batfile file type relationship as well as the actual parameters for launching a batfile.

Windows Registry Editor Version 5.00

[-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bat]
[-HKEY_CURRENT_USER\Software\Classes\.bat]
[-HKEY_CURRENT_USER\SOFTWARE\Classes\batfile]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.bat]
@="batfile"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shell\open\command]
@="\"%1\" %*"

I had the same problem (in Windows 7); batch files were opening in Notepad instead of being executed.

Correcting the below registry for .bat files (as per any other machine where it works) will make the batch execute correctly:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\

.bat                --> default-> Value not set
.bat/OpenWithList   --> default-> Value not set
.bat/OpenWithProgIds--> default-> Value not set
                        batfile-> Zero length binary values 

Keep these entries but remove all others under .bat. Refresh and run a batch file by double clicking - it will run correctly.