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.

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

Many files originating in the UNIX world come without file extension. Popular examples include README, INSTALL, LICENSE.

We know for a fact that these are text files. It is therefore a bit disappointing not to be able to just double-click them open in Explorer and see them in Notepad (actually, Notepad2 because of the UNIX line endings which silly Microsoft Notepad doesn't render correctly).

Does anyone know of a way to create a file association for, say, README files without extension? This could then be replicated to cover the most frequently occurring file types, and then double-clicking them open would work.


Update (Sort of in response to all your comments.) Thanks, folks, your comments and answers have helped me.

@Indrek, yes, I was under the assumption that you could somehow create an association for just README or Makefile, and couldn't do so for files without extension. Turns out the contrary is true, and yes, that is a workaround that neatly solves the issue.

Ultimately, I just want to be able to double-click to open a README or Makefile, that's all.

@Sampo, the SendMe trick is also useful, although usability is not as great as a straight double-click. (I'm really lazy sometimes.)

Turns out the following trick using ftype and ftype from an Administrator prompt does the double-click enabling job:

assoc .=no_ext
ftype no_ext=%SystemRoot%\system32\NOTEPAD.EXE %1
:: You can see it created some entries in the registry:
reg query hkcr\no_ext /s
reg query hkcr\. /s
share|improve this question

marked as duplicate by Ƭᴇcʜιᴇ007, Canadian Luke, Factor Mystic, 8088, soandos Sep 4 '12 at 2:13

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
My understanding is that from Windows' perspective, if there is no . in the filename, it doesn't have an extension. And if it doesn't have an extension, you can't associate a program to open it with. So a README file is no, in fact, a README file... it's just a file. I'd be interested to see if there's some sort of workaround for this. –  nhinkle Sep 3 '12 at 18:42
2  
    
@Indrek Seems like a straight up duplicate to me? –  Ƭᴇcʜιᴇ007 Sep 3 '12 at 18:58
    
@nhinkle Don't know if my workaround is good enough but it does the job, of course we can make it better by moving menu item to root menu. Maybe i'll look in it when i have more than few minutes for it. –  Sampo Sarrala Sep 3 '12 at 19:06
2  
@techie007 Not necessarily. The OP is asking if it's possible to create a file association based on filename, to which the answer is "no". Creating an association for files with no extension is a workaround in this case. –  Indrek Sep 3 '12 at 19:07

2 Answers 2

up vote 5 down vote accepted

You can't create a file association based on the filename, but you can create one for files with no extension. To do that, save the following as a .reg file and double-click on it:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.]

[HKEY_CLASSES_ROOT\.\shell]

[HKEY_CLASSES_ROOT\.\shell\open]

[HKEY_CLASSES_ROOT\.\shell\open\command]
@="Notepad.exe %1"

Replace Notepad.exe with whatever text editor you wish to use.

You can, of course, also create the registry keys and value manually with regedit.exe.

Also see this question and its answers.

share|improve this answer
    
Yeah, this is it! From the answers in the question you're referring to, I very much prefer the assoc/ftype, run from an administrator prompt. Thanks! –  Lumi Sep 4 '12 at 0:00

You could always create additional menu item, that will open selected file on notepad, for all files.

It is extremely simple, here is how to do it:

1. Open Send To folder. In Windows 7 this folder is C:\Users\TestUser10\AppData\Roaming\Microsoft\Windows\SendTo, just change TestUser10 to be your user name or use All Users profile.

2. Create new shortcut link to notepad.exe with description `"Notepad".

Now it is ready for use

Right click on any file and select "Send To" => "Notepad" and Windows will open selected file in notepad.

Note: This works with all Windows versions with "Send To" functionality, you just need to find Send To folder and create shortcut to notepad.exe. 95, 98, ME, 2000, XP, Vista, 7 ... has it but folder path could vary.

Update:

Okay, I got it (after reading techie007's comment).

Here is how you can associate program to FILENAME (or FILENAME.EXT if you want to) by using above instructions as starting point.

Just do not create shortcut as I suggested above but create new File Editor.cmd and here is contents of File Editor.cmd (Change cases as you like):

GOTO FILE_%~n1

:FILE_NOTEPAD
START notepad.exe %1
GOTO EOF

:FILE_nicepic.jpg
START mspaint.exe %1
GOTO EOF

:FILE_config.sys
edit.com %1
GOTO EOF

:EOF

Okay, that was just quick sketch. Anyone is welcome to improve it, one suggestion is using IF ... ELSE statements to get default fallback program (hex editor for example) for any file type/name that is not defined. With conditional statements one could also use findstr regular expressions for determining launcher by parts of filename.

Update: Integration with file associations

This part is about integrating above with Indrek's answer.

Idea is pretty simple, just write above batch file (or even better, real program with similar functionality) but instead of "Send To"-folder place it to System32 folder (just don't place it inside Send To).

After you have your script/program ready follow Indrek's answer with one exception: use file editor.cmd %1 (or whatever you've named your batch/program) instead of notepad %1.

This enables you to use both: selecting application by filename and simple double clicking from Windows Explorer.

share|improve this answer
    
The GOTO idea is nice and simple, but there should be a default behavior. Some sort of Open with dialog, if possible. –  sudo Sep 3 '12 at 19:54
    
Thank you, this is useful to know. For this case, however, I find the ASSOC/FTYPE for . more practical. +1 nonetheless. –  Lumi Sep 3 '12 at 23:58
    
@Lumi If you want to improve functionality of <i>unknown file association</i> see my last update. This is only useful if you want different app for README and LICENSE. –  Sampo Sarrala Sep 4 '12 at 15:28

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