How to Associate a Program with Files that have No Extension

Shell extensions for file names with no file extension can be registered under the following:

[HKEY_CLASSES_ROOT\.]

For example, to associate a program (for example, Notepad.exe) to open all files with no extension, use the following registry keys:

[HKEY_CLASSES_ROOT\.]
@=""

[HKEY_CLASSES_ROOT\.\shell]

[HKEY_CLASSES_ROOT\.\shell\open]

[HKEY_CLASSES_ROOT\.\shell\open\command]
@="<path to notepad.exe> %1"

Here is an alternative method:

[HKEY_CLASSES_ROOT\.]
@="NoExtFile"

[HKEY_CLASSES_ROOT\NoExtFile]

[HKEY_CLASSES_ROOT\NoExtFile\shell]

[HKEY_CLASSES_ROOT\NoExtFile\shell\open]

[HKEY_CLASSES_ROOT\NoExtFile\shell\open\command]
@="<path to notepad.exe> %1"

NOTE: “NoExtFile” is not a predefined name, and therefore it can be anything. Adding other shell extensions is similar to adding shell extensions for file names with extensions.

This article was previously published under Microsoft KB Q236014, titled “INFO: Shell Extensions for File Names with No File Extension.”

Whereas, implementing the menu under the following key shows the menu for all file types — including the extension-less files.

HKEY_CLASSES_ROOT\*\shell

Example

You can add shell menu entries (e.g., “Open with Notepad“, “Open with Notepad++“, etc.) for extension-less files under the [HKEY_CLASSES_ROOT\.] registry key.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.\shell\openwithnotepad]
@="Open with Notepad"

[HKEY_CLASSES_ROOT\.\shell\openwithnotepad\command]
@="c:\\windows\\notepad.exe \"%1\""

The above registry file adds the following registry keys and values:



associate extension-less files with a program

The Notepad entry is now shown in the right-click menu for extension-less files (only).

associate extension-less files with a program

As there are no other menu entries, the Notepad option will be the default — i.e., double-clicking a file with no extension opens it in Notepad. If you don’t want to make it the default context menu option, you’ll have to add the NeverDefault registry value, as below:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.\shell\openwithnotepad]
@="Open with Notepad"
"NeverDefault"=""

[HKEY_CLASSES_ROOT\.\shell\openwithnotepad\command]
@="c:\\windows\\notepad.exe \"%1\""

The above registry file adds the custom menu item but doesn’t make it as the default — i.e., “Open with” remains as the default option.


One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support. It won't take more than 10 seconds of your time. The share buttons are right below. :)

Ramesh Srinivasan is passionate about Microsoft technologies and he has been a consecutive ten-time recipient of the Microsoft Most Valuable Professional award in the Windows Shell/Desktop Experience category, from 2003 to 2012. He loves to troubleshoot and write about Windows. Ramesh founded Winhelponline.com in 2005.

Leave a Reply