In Windows 7, if you aren't up to editing the registry, it's Start > Control Panel > Default Programs > Associate a filetype or protocol with a particular program. (Often takes a long time to load!) ".cmd" should be associated with "Windows Command Script". Since it's obviously not, click Change Program, Browse to \windows\system32\cmd.exe and select it, checkmark the box for "always use", and that should fix the association.
Or you can do it directly in the registry, but the location will be under HKEY_CLASSES_ROOT, where file associations are set. CMD files are by default associated with the "plain text persistent handler". Default is:
======= for the .CMD extension ===========
REGEDIT4
[HKEY_CLASSES_ROOT\.cmd]
@="cmdfile"
[HKEY_CLASSES_ROOT\.cmd\PersistentHandler]
@="{5e941d80-bf96-11cd-b579-08002b30bfeb}"
====== for CMDFILE type ==============
REGEDIT4
[HKEY_CLASSES_ROOT\cmdfile]
@="Windows Command Script"
"EditFlags"=hex:30,04,00,00
"FriendlyTypeName"=hex(2):40,25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,53,79,73,\
74,65,6d,33,32,5c,61,63,70,70,61,67,65,2e,64,6c,6c,2c,2d,36,30,30,33,00
[HKEY_CLASSES_ROOT\cmdfile\DefaultIcon]
@=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,53,79,73,74,65,6d,33,32,5c,69,\
6d,61,67,65,72,65,73,2e,64,6c,6c,2c,2d,36,38,00
[HKEY_CLASSES_ROOT\cmdfile\shell]
[HKEY_CLASSES_ROOT\cmdfile\shell\edit]
[HKEY_CLASSES_ROOT\cmdfile\shell\edit\command]
@=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,53,79,73,74,65,6d,33,32,5c,4e,\
4f,54,45,50,41,44,2e,45,58,45,20,25,31,00
[HKEY_CLASSES_ROOT\cmdfile\shell\open]
"EditFlags"=hex:00,00,00,00
[HKEY_CLASSES_ROOT\cmdfile\shell\open\command]
@="\"%1\" %*"
[HKEY_CLASSES_ROOT\cmdfile\shell\print]
[HKEY_CLASSES_ROOT\cmdfile\shell\print\command]
@=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,53,79,73,74,65,6d,33,32,5c,4e,\
4f,54,45,50,41,44,2e,45,58,45,20,2f,70,20,25,31,00
[HKEY_CLASSES_ROOT\cmdfile\shell\runas]
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\cmdfile\shell\runas\command]
@=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,53,79,73,74,65,6d,33,32,5c,63,\
6d,64,2e,65,78,65,20,2f,43,20,22,25,31,22,20,25,2a,00
[HKEY_CLASSES_ROOT\cmdfile\shell\runasuser]
@="@shell32.dll,-50944"
"Extended"=""
"SuppressionPolicyEx"="{F211AA05-D4DF-4370-A2A0-9F19C09756A7}"
[HKEY_CLASSES_ROOT\cmdfile\shell\runasuser\command]
"DelegateExecute"="{ea72d00e-4960-42fa-ba92-7792a7944c1d}"
[HKEY_CLASSES_ROOT\cmdfile\ShellEx]
[HKEY_CLASSES_ROOT\cmdfile\ShellEx\ContextMenuHandlers]
@="Compatibility"
[HKEY_CLASSES_ROOT\cmdfile\ShellEx\ContextMenuHandlers\Compatibility]
@="{1d27f844-3a1f-4410-85ac-14651078412d}"
[HKEY_CLASSES_ROOT\cmdfile\ShellEx\DropHandler]
@="{86C86720-42A0-1069-A2E8-08002B30309D}"
[HKEY_CLASSES_ROOT\cmdfile\ShellEx\PropertySheetHandlers]
[HKEY_CLASSES_ROOT\cmdfile\ShellEx\PropertySheetHandlers\ShimLayer Property Page]
@="{513D916F-2A8E-4F51-AEAB-0CBC76FB1AF8}"
[HKEY_CLASSES_ROOT\cmdfile\ShellEx\{8895b1c6-b41f-4c1c-a562-0d564250836f}]
@="{1531d583-8375-4d3f-b5fb-d23bbd169f22}"
Something is out-of-whack for sure. If you right-click a .CMD then by default the highlighted action should be "Open", not the name of the .CMD. Also Notepad++ doesn't appear to associate to .CMD file by default. – Ƭᴇcʜιᴇ007 – 2013-10-01T16:50:05.720
If you navigate to the path of the cmd file, in explorer do you see the batch icon or a notepad icon? – Austin T French – 2013-10-01T16:50:21.960
1@AthomSfere it's a Notepad++ icon! – n611x007 – 2013-10-01T16:51:49.100
@techie007 sorry I realize the bold name was due me right-clicking it in Total commander. I did it in explorer and there it's 'open'. But the behavior is still wrong. Edited the q. – n611x007 – 2013-10-01T16:57:11.463
@techie007 I think definitely not N++: it does not associate like this (by default), I didn't do it willingly at least not from N++, and I use N++ for a long time and didn't do any updates recently. – n611x007 – 2013-10-01T16:58:37.750
1Under
HKLM/Software/Classes/.cmd/PersistentHandler
there should be a GUID as the (Default). For exmaple: {5e941d80-bf96-11cd-b579-08002b30bfeb}. Search the registry further for that GUID and it should (eventually) lead to you toHKLM\SOFTWARE\Classes\CLSID\{5e941d80-bf96-11cd-b579-08002b30bfeb}
(again the GUID is an example, might not be the same on yours), which should have a default value of "Plain Text persistent handler". Is that the case for you? If this just started happening, have you tried a System Restore back to a point when it was working as expected? – Ƭᴇcʜιᴇ007 – 2013-10-01T17:02:36.707@techie007 exact same values as for you everywhere. did not try restore yet. – n611x007 – 2013-10-01T17:07:26.740