Remove file association from batch file type on Windows 7

6,108
  1. Download this .reg file.

  2. Save the .reg file to your desktop.

If the link does not work, open Notepad and paste the following code, then save it as RestoreBAT.reg (not .txt.reg)

Windows Registry Editor Version 5.00

; Created by: Shawn Brink
; http://www.sevenforums.com
; Tutorial: http://www.sevenforums.com/tutorials/19449-default-file-type-associations-restore.html


[-HKEY_CLASSES_ROOT\.bat]

[HKEY_CLASSES_ROOT\.bat]
@="batfile"

[HKEY_CLASSES_ROOT\.bat\PersistentHandler]
@="{5e941d80-bf96-11cd-b579-08002b30bfeb}"

[HKEY_CLASSES_ROOT\batfile]
@="Windows Batch File"
"EditFlags"=hex:30,04,00,00
"FriendlyTypeName"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,\
  00,6f,00,6f,00,74,00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,\
  32,00,5c,00,61,00,63,00,70,00,70,00,61,00,67,00,65,00,2e,00,64,00,6c,00,6c,\
  00,2c,00,2d,00,36,00,30,00,30,00,32,00,00,00

[HKEY_CLASSES_ROOT\batfile\DefaultIcon]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
  00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,69,00,6d,00,\
  61,00,67,00,65,00,72,00,65,00,73,00,2e,00,64,00,6c,00,6c,00,2c,00,2d,00,36,\
  00,38,00,00,00

[HKEY_CLASSES_ROOT\batfile\shell]
@=""

[HKEY_CLASSES_ROOT\batfile\shell\edit\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
  00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,\
  54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,25,00,31,00,00,\
  00

[HKEY_CLASSES_ROOT\batfile\shell\open]
"EditFlags"=hex:00,00,00,00

[HKEY_CLASSES_ROOT\batfile\shell\open\command]
@="\"%1\" %*"

[HKEY_CLASSES_ROOT\batfile\shell\print]

[HKEY_CLASSES_ROOT\batfile\shell\print\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
  00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,\
  54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,2f,00,70,00,20,\
  00,25,00,31,00,00,00

[HKEY_CLASSES_ROOT\batfile\shell\runas]
"HasLUAShield"=""

[HKEY_CLASSES_ROOT\batfile\shell\runas\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
  00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,63,00,6d,00,\
  64,00,2e,00,65,00,78,00,65,00,20,00,2f,00,43,00,20,00,22,00,25,00,31,00,22,\
  00,20,00,25,00,2a,00,00,00

[HKEY_CLASSES_ROOT\batfile\shell\runasuser]
@="@shell32.dll,-50944"
"Extended"=""
"SuppressionPolicyEx"="{F211AA05-D4DF-4370-A2A0-9F19C09756A7}"

[HKEY_CLASSES_ROOT\batfile\shell\runasuser\command]
"DelegateExecute"="{ea72d00e-4960-42fa-ba92-7792a7944c1d}"

[HKEY_CLASSES_ROOT\batfile\ShellEx]

[HKEY_CLASSES_ROOT\batfile\ShellEx\ContextMenuHandlers]
@="Compatibility"

[HKEY_CLASSES_ROOT\batfile\ShellEx\ContextMenuHandlers\Compatibility]
@="{1d27f844-3a1f-4410-85ac-14651078412d}"

[HKEY_CLASSES_ROOT\batfile\ShellEx\DropHandler]
@="{86C86720-42A0-1069-A2E8-08002B30309D}"

[-HKEY_CLASSES_ROOT\SystemFileAssociations\.bat]

[-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bat]
  1. Right click on the downloaded .reg file, and click on Merge.

  2. If prompted, click on Run, Yes (UAC), Yes, and OK.

  3. When finished, you can delete the downloaded .zip or .reg files on the desktop if you like.

  4. Log off and log on, or restart the computer to apply.

NOTES: If you wish to see what changes will be made by the REG file, then you can right click on the extracted REG file and click on Edit to see the default registry entries that will be added. REG files are just text files. The "Edit" function just opens them in Notepad.

If you are logged in a standard user account, then you will get a Cannot import type error. Just click on OK for it. This is normal since what cannot be imported can only be done so by an administrator account instead. It will still restore the default association of the file extension though.

Source: http://www.sevenforums.com/tutorials/19449-default-file-type-associations-restore.html

Share:
6,108

Related videos on Youtube

GreenGiant
Author by

GreenGiant

Programming, refactoring and new technology enthusiast. I work mostly with the following: Java AWS Javascript / React Hive #SOreadytohelp I am a follower of Christ - He has filled my life with truth, joy and, well, life! There is no greater adventure I've found than following Him.

Updated on September 18, 2022

Comments

  • GreenGiant
    GreenGiant almost 2 years

    Possible Duplicate:
    How do I restore .bat files as executables?

    Recently I noticed that batch files (*.bat) now open using Notepad++ (NP++), rather than the file being executed. I don't know how this association to NP++ was created (I installed NP++ a long time ago, and I don't remember making the association myself).

    Control Panel -> Default Programs -> Set Associations shows that .bat / BAT File / Notepad++

    I tried following the instructions in How to delete a file association? but the association remains.

    • ftype yields batfile="%1" %*, which appears to be correct.
    • assoc yields nothing for .bat

    I tried running assoc .bat=batfile but the assocation to NP++ still shows up in Control Panel, and batch files still open in NP++.

    How can I restore batch files to their proper association so that they are run, instead of being opened in NP++?

    --

    UPDATE: After some more research, it appears I might have made this association through some variant of Right-click -> "Open With..."

  • GreenGiant
    GreenGiant over 9 years
    Your link to the file is now broken. Perhaps putting the contents of the file in your answer would be helpful.