.cmd runs from cmd.exe but not from start menu / Run dialog

problem

If I run a .cmd file from cmd.exe it works fine. However if I run it from Start menu / Run line, it opens in Notepad++, my editor. (edit I've it installed for years, didn't update it recently. However, this phenomenon with the .cmds only started recently.)

Both time, I use a full absolute path. I use windows 7 x64.

registry

My HKLM/Software/Classes/cmdfile/shell/open/command's (Default) is set to "%1" %* and .cmd's (Default) is cmdfile in both HKLM and HKCU and there is no cmdfile in HKCU.

However the other keys I did not check / did not understand their meaning or significance, in particular I don't know an easy way to follow clsid values, and know what do they mean as a given key.

context menu

If I right click a .cmd the bold text is its name (edit) says "Open". But even from here if I click open, it opens in notepad++, my text editor.

icon (edited) If I go to the folder in explorer, the icon is a Notepad++ icon.

question

Why is the Run line behaving differently from the command line?

How can I restore my .cmds to run from the Run dialog, too?


Make a backup of the registry.

After that you should delete any values with "Notepad++" under the following key:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.cmd

The only keys I have under there are:

REGEDIT4

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.cmd]

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.cmd\OpenWithList]

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.cmd\OpenWithProgids]
"cmdfile"=hex(0):

It sounds like you have somehow changed your default file association for .cmd files.

Navigate to any .cmd file:

  • Right Click and select properties
  • Where you see "Opens With" -> Click
  • Navigate to %Systemroot%\System32\
  • Choose cmd.exe

Your default association should now be fixed!