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}"
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 Oct 1 '13 at 17:02