Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question
    
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
add comment

7 Answers

up vote 16 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
share|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
3  
@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

With the command line:

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

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 .=
share|improve this answer
    
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
3  
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
3  
FWIW, in Win7 you need to run cmd as Administrator –  Cristi Diaconescu Oct 9 '12 at 9:19
1  
OK, one more: in the above example, no_ext is what Windows Explorer will display in the 'Type' column for such files. I think a more readable description would be better, so I used "No extension" , including the double quotes, instead of no_ext in the above commands. –  Cristi Diaconescu Oct 9 '12 at 9:26
2  
Here's how I set the icon for .txt files for files with no extension (thanks @grawity for the pointer and idea): assoc "No extension"\DefaultIcon=%SystemRoot%\system32\imageres.dll,-102 –  Cristi Diaconescu Oct 9 '12 at 9:35
show 1 more comment

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"
share|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 '12 at 21:26
add comment
  • Start the registry editor (regedit.exe)
  • Move to HKEY_CLASSES_ROOT \ *\ . \
  • Then move to or create this path shell \open \command
  • double click Default when in the command directory and put in your path to your editor e.g.

    C:\PFE\pn.exe "%1"
    

This enables the PFE editor to open files with no extension if you have PFE on your C drive.

share|improve this answer
add comment

You can also use NirSoft FileTypesManager:

FileTypesMan is an alternative to the 'File Types' tab in the 'Folder Options' of Windows.

FileTypesMan also allows you to easily edit the properties and flags of each file type, as well as it allows you to add, edit, and remove actions in a file type.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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"
share|improve this answer
    
Please, in the future, include the most relevant parts here, on site, rather than just providing a link. Thanks. –  slhck Aug 14 '13 at 16:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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