Jul 242009

Recently I was facing the issue whether it’s possible to associate files with a certain filename to be opened with a particular program in Windows operating systems. These could be files named TODO, README, INSTALL, LICENSE and the likes, as they are widely common in the unix world.

My first try via tweaking the registry (adding an entry in the HKEY_CLASSES_ROOT as you would normally do for an extension) was without success. Also other tweak programs, which are capable of setting file associations, fail to do this for files which do not have an extension.
When looking for a solution on the web, I came across this blog entry of Elijah Grey, who wrote a batch file with which you’ll be able to associate all files without file extension to any program. He uses the command line tools ftype and more importantly assoc. Even though this solution is neat, it didn’t quite satisfy my needs – because I might want to associate different filenames (without extensions) to different programs.
Looking at the help of assoc, the command line tool just handles extensions (as parameters), e.g. “.txt” or just “.” for files without extension. But it is not able to use the parameter as desired fixed filename (without extension). As you can see from my comment to the blog entry, Elijah stated that it is not possible to associate certains file names to a program under Windows.

This means, at least for the time being I will not be able to restrict file associations of files without file extension to just certain filenames.

However, when you think about this issue, you will face the following questions:

  • where do the files come from / where are or were they created?
  • which program should they be associated?

The answer to the first question is, of course, for the most part such files will have something to do with Unix – and furthermore therefore most likely not have Windows line breaks. That means (starting to find the answer to the second question), if you intended the special files to be associated with notepad, the standard Windows editor, it would not be neatly formatted in the first place.
But on the other hand, if you wanted those files to be associated with your favorite editor (UltraEdit, SciTe, EmEditor, Notepad++, Programmer’s Notepad, … just to name a few), with which you wouldn’t have line break issues, actually all of those editors have the option to be integrated in the right-click context menu (of any file explorer). That means, to edit those files instead of double-clicking you would have to go through one right-click and then one left-click.

The way via the context-menu obviously takes more time (and time adds up 😉 ) and is still no solution to the original problem. But it seems, for the moment we will just have the option of the context-menu or (using assoc or Elijah’s script) to associate all files without file extension with a program. Meaning, no two different programs for two differently named files – but let’s be honest, most of the files without extensions (see above for the examples) are simple text files anyway :)

  One Response to “File association for certain filenames without file extension under Windows”

  1. […] File association for certain filenames without file extension … […]

 Leave a Reply




You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">