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

link|improve this question

50% accept rate
Accepted answer worked but at the same time made other feature stop working; Choose Default Program does not work (is broken) on Windows – Piotr Dobrogost Jun 13 '10 at 11:00
feedback

3 Answers

up vote 12 down vote accepted

From Windows IT pro:

Normal files with an extension can have a program associated however this is not the case with files that don't have an extension. If you double click on one and select an application and check the box to always use that application it is ignored and every time you select a file you have to choose the application.

You can force this using the registry:

  • Start the registry editor (regedit.exe)
  • Move to HKEY_CLASSES_ROOT
  • From the Edit menu select New - Key
  • Enter a name of '.' and press Enter (don't type the quotes)
  • Select the new '.' key
  • Double click the (Default) value
  • Change to the HKEY_CLASSES_ROOT used to open, e.g. NOTEPAD for the notepad.exe application NOTEPAD
  • Click OK

alt text

If you now double click on a file with no extension it will open with the application selected.

To check what an existing application used look at its entry under HKEY_CLASSES_ROOT, e.g. HKEY_CLASSES_ROOT.doc uses Word.Document.8 so if you wanted this as your default editor you would change HKEY_CLASSES_ROOT.(Default) to Word.Document.8.

Any method which avoids the need to edit the registry is as follows:

  • Open Explorer - View - Folder Options... - File Types - New Type:
  • Description of type: Text (any description, you can type in)
  • Associated extension: . (just a period)
  • Actions: - new...
  • Action: open
  • Application used to perform action: c:\winnt\notepad.exe
  • Click ok, then ok again
link|improve this answer
There's something wrong with above info. I have .xml files set to open with Notepad++ but (Default) entry for .xml is set to xmlfile... – Piotr Dobrogost Jul 27 '09 at 19:49
I don't really understand what you mean, but I'm afraid I wouldn't know a solution either... – Ivo Flipse Jul 27 '09 at 19:50
1  
@Piotr: If the default entry of HKCR\.xml is xmlfile, it means the shell (Explorer) needs to go to HKCR\xmlfile and read information from that key. – grawity Jul 28 '09 at 7:02
@grawity should I edit something in my post? – Ivo Flipse Jul 28 '09 at 7:05
Did this work for you Piotr? – Ivo Flipse Aug 24 '09 at 5:39
show 7 more comments
feedback

With the command line:

ftype no_ext=c:\path\to\my_editor.exe "%1"
assoc .=no_ext

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

link|improve this answer
4  
+1, +1, +1 - a thousand times +1 – Dennis Williamson Jul 28 '09 at 3:31
Offtopic, but try giving, for example, no_ext\DefaultIcon as the first argument to assoc. It isn't limited to just extensions. – grawity Jul 28 '09 at 7:04
i was just about to ask this question....thank you thank you thank you thank you! – espais Nov 6 '09 at 9:33
This is a great solution! thx – John May 10 '11 at 12:31
Note that if your editor is in a folder that contains a space (such as "C:\Program Files") you need to put it into quotes. ftype no_ext="C:\Program Files (x86)\Notepad++\notepad++.exe" "%1" – GuiSim Nov 8 '11 at 16:19
feedback

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"
link|improve this answer
There's something wrong with the above info. When I click newly created .reg file I get "The specified file is not a registry script" error. – Piotr Dobrogost Jul 27 '09 at 19:54
Apologies Piotr, try now, I've added a further line to the top of it. – Pauk Jul 27 '09 at 20:39
This works in Explorer but does not work in Total Commander which should behave (and always has) identically to Explorer in this regard. Any thoughts? – Piotr Dobrogost Sep 23 '09 at 12:36
The idea that you should have to set file associations for EVERY unknown file in Windows is insane. Well done sir! – Steven Penny Mar 30 at 21:26
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.