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..."

  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




@="Windows Batch File"





@="\"%1\" %*"












  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

| improve this answer | |
  • Your link to the file is now broken. Perhaps putting the contents of the file in your answer would be helpful. – GreenGiant Jan 7 '15 at 17:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.