I use WinXP sp3, and I have created a .bat file that does something. When I double click on it, a Notepad is opened and I can edit the batch file - but it is not run ??!?!
I expect that when I double click a .bat file - it should run, no? How can I fix this?
Open console as Administrator and type:
assoc .bat=batfile
I see your problem.
Your batch file may not be saved with the .bat extension.
If you are editing a batch file in Notepad: try this:
For Notepad++ users:
Hoping this one solved quite everyone's problems!
If not, I'm pretty sure you have a problem with your default file associations. Fortunately, there is a way to fix that.
The next time you want to edit your files in a text editor, right click the file and choose "Edit with Notepad++" or "Edit".
Hope this helped.
In reverse of the original question, I wanted double click to open .cmd & .bat files in an editor.
I've used:
So double clicking on a .
cmd
file opens in a chosen editorcheck
assoc
andftype
. By default this should look like:If it's not, see
assoc /?
andftype /?
how to change it.In my case none of the answers worked, because i have Notepad ++ as text editor and the .bat file was associated to it. Hence if you use Notepad ++ open it and go to:
Configuration / Preferences / File Association
and remove the .bat entry from the Registered Extensions.
I had a similar problem on Windows 10, all bat files opened with Notepad++.
I resolved it by going to
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.bat
and changing theData
value fromNotepad++_file
tobatfile
This solution fixes the problem on Windows 7 as well.