Home » Questions » Computers [ Ask a new question ]

How to set the default program for opening files without an extension in Windows?

How to set the default program for opening files without an extension in Windows?

How to set the default program for opening files without an extension in Windows?

Asked by: Guest | Views: 55
Total answers/comments: 5
Guest [Entry]

"With the command line:

assoc .=""No Extension""
ftype ""No Extension""=""C:\path\to\my editor.exe"" ""%1""

Restart the computer for the changes to take effect.

To give credit, I learned this from the vim wikia here and here

Extra info:

Instead of ""C:\path\to\..."", the following macros may be useful:

%SystemDrive% - drive windows is installed on, i.e. C:\
%ProgramFiles% - e.g. ""C:\Program Files\""
%ProgramFiles(x86)% - e.g. ""C:\Program Files (x86)\""

You will need to properly escape them though:

ftype ""No Extension""=^""^%ProgramFiles(x86)^%\Notepad++\notepad++.exe^"" ""%1""

To set the icon to be the same as .txt files (I didn't do this, since it automatically made the files' icons display as Notepad++ files):

assoc ""No Extension""\DefaultIcon=%SystemRoot%\System32\imageres.dll,-102

To undo, you can read the assoc /? or ftype /? information, e.g.:

ftype ""No Extension""=
assoc ""No Extension""\DefaultIcon=
assoc .="
Guest [Entry]

"This is an example of .reg file for getting Notepad to open unknown file extensions. Create a new text file with an extension of .reg, cut and paste this into it, then double click to run and it'll put it into the registry.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Unknown\shell]
@=""notepad""

[HKEY_CLASSES_ROOT\Unknown\shell\notepad]
@=""Open with Notepad""

[HKEY_CLASSES_ROOT\Unknown\shell\notepad\command]
@=""C:\\WINDOWS\\NOTEPAD.EXE %1"""
Guest [Entry]

"Can't believe nobody has said this yet. You don't need to provide a path to your text editor like the accepted answer says.

Just run the following in an admin command prompt:

assoc .=txtfile"
Guest [Entry]

"Pauk's answer didn't work for me, I had to use instead:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT.]
@=""No Extension""

[HKEY_CLASSES_ROOT\No Extension]

[HKEY_CLASSES_ROOT\No Extension\Shell]

[HKEY_CLASSES_ROOT\No Extension\Shell\Open]

[HKEY_CLASSES_ROOT\No Extension\Shell\Open\Command]
@=""C:\\pathtoexe\\yourexe.exe %1""

Note the double backslashes on the exe path."
Guest [Entry]

"The other answers are a bit outdated. Here is a link to one that works for Windows 7:

Shell Extensions for File Names with No File 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"""