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

Solution 1:

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.

Solution 2:

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\" %*"

Solution 3:

None of the answers above fixed it for the machine I was working with, but what fixed it was starting an Admin Shell and running

assoc .bat=batfile
assoc .cmd=batfile