How to set default program for files with no extension in Windows

If you frequently need to open files without file name extension in Windows, such as the hosts file or some Linux files, you might have found out that its pretty tedious work.

First, you cannot directly associate file without extension to a program, like the obvious Notepad choice. Even if you use the Open with..  option you will see that the box for "Always use the selected program to open this kind of file" is grayed out for files with no extension.

Second, files like hosts file needs administrative right to be edited/saved and for some reason (probably security), you cannot set Notepad so it's always opened with administrator rights, like you can do with other programs. So you need to do it the other way, and first launch Notepad with administrative rights and then browse to the hosts file to edit it.

For something that trivial, pretty heavy load of work. But, we have found a way how to make this much easier and finally Associate file with no extension to a program!

Associating file with no extension to a program

It's really simple and quick solution. Simply copy and paste the following lines to a newly created text file on your desktop, save it, and rename the extension to REG, so you can import it to Windows Registry. Our example is for Notepad++ installed in its default location. Change it to whatever text editor or other program you want files with no extension to be associated with.

Because you cannot launch Windows Notepad with administrator rights by default, it is best to pick another program like Notepad++, PSPad etc. where you can set it, so you can easily use it to edit system protected files like the hosts file.

[HKEY_CLASSES_ROOT\.]
@=""

[HKEY_CLASSES_ROOT\.\shell]

[HKEY_CLASSES_ROOT\.\shell\open]

[HKEY_CLASSES_ROOT\.\shell\open\command]
@="<C:\Program Files (x86)\Notepad++\notepad++.exe> %1"

When your file is ready, double click on it, to add it to your Windows Registry - and that's it. When you now open file with no extension it will by opened by the default program.

 

Alternative method:

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.

[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 your notepad.exe or other text editor> %1"

Related software and links:

Microsoft Windows NotePad icon

Microsoft Windows NotePad    Microsoft Windows platform
The basic simple text editor included in Microsoft Windows operating systems

 
NotePad++ text editor icon

NotePad++ text editor    Microsoft Windows platform
A free source code and text editor for Windows

 
PSPad icon

PSPad    Microsoft Windows platform
A freeware code editor for Windows

 

Add new comment about “Set default program for files with no extension in Windows

Go to:
Article related software
Add comments...

Enter any file extension without dot (e.g. pdf)
Search for file extension details and associated application(s)

RSS feed