Associate Extensionless Files with Notepad in WinXP
by Jeff Starr on Tuesday, August 8, 2006 – 24 Responses
There are several files that appear not to have extensions in Windows XP. Perhaps the best known example is the HOSTS file. Files such as the HOSTS file that appear to be "extensionless" actually contain an invisible period "." — or dot — at the end the file name. It is this invisible dot that will enable us to select a specific program with which to open files with no extensions.
As web developers, we are constantly checking and consulting server-generated error_log files. Like the HOSTS file, the error_log files appear to have no associated extension. In Windows XP, opening extensionless files requires opening the "Open with…" dialogue box and scrolling through a long list of file types. And, although there is a checkbox option within the dialogue box enabling users to "Always use the selected program to open this kind of file," the option is "greyed out" and useless. Thus opening an extensionless file requires four or five extra "clicks", as well as the extra time it takes to jump through the hoops. This may not sound like a big deal, but try opening any number of files by this method and the extra clicks begin to add up.
After opening our millionth error_log file using the "Open with" method, we decided to confront the problem and devise a solution. After a bit of research, we were presented with several options: editing the registry, installing software, or tweaking Windows "Folder Options". After fiddling with the registry and installing some software with no real progress, we decided to try the heretofore unsuccessful "Folder Options" method. Sure enough, armed with an invisible dot and a slight tweak, we were finally able to convince Windows XP to associate extensionless file types with Notepad, our program of choice for such files.
The Solution
Although this solution is relatively risk-free 1, requiring no registry editing or software installation, the process is fairly sensitive, requiring careful attention. Below are two methods: the first associates extensionless files with Notepad, while the second does such with WordPad. Both assume a Windows XP operating system.
Here is the method of associating extensionless file types with Notepad in WinXP:
- Open Windows Explorer and go to the "Tools › Folder Options › File Types" menu.
- Click the "New" button and type ".txt" in the "File Extension" field.
- Click on the "Advanced ››" button and the "Associated File Type" should read "Text Document". If it is blank, or says something else, close everything out and start over, making sure to follow the steps in order.
- Finally, in the "File Extension" field, replace the ".txt" with a single dot, "."
- Click "OK" and exit. Find or create an extensionless file and check it out.
Here is a similar method of associating extensionless file types with WordPad in WinXp:
- Open Windows Explorer and go to the "Tools › Folder Options › File Types" menu.
- Click the "New" button and type ".txt" in the "File Extension" field.
- Click on the "Advanced ››" button and the "Associated File Type" should read "Text Document". If it is blank, or says something else, close everything out and start over, making sure to follow the steps in order.
- Open the "Associated File Type" dropdown menu. Scroll down and select "Wordpad Document".
- Finally, in the "File Extension" field, replace the ".txt" with a single dot, "."
- Click "OK" and exit. Find or create an extensionless file and check it out.
Footnotes
- 1 It is always a good idea to backup your registry and other critical documents before implementing any system changes.






24 Responses
Marton Sari – #1
After this you can associate it with anything you want. Just go to “Tools ? Folder Options ? File Types” again, select the first one in the list (the extensionless filetype), click “Modify” and select the appropriate program. The “Always use the selected program to open this kind of file” checkbox is greyed out again, but now it is checked!
Perishable – #2
Excellent, Marton — thank you for the helpful information!
Fernando – #3
Didn’t work with me!
What’e wrong?
Perishable – #4
It is difficult to say, Fernando. Keep trying!
Nugsoloy – #5
I agree with Cameron, i’ve been dealing with this with files output from Kiwi conf puller and everytime having to ‘open with..’ Finally i realized there had to be a better way.. Thanks Perishable Press great tip!!
Perishable – #6
Many thanks for the kind remarks!
CodeMonkey – #7
Great stuff! I work in a mixed development environment of Windows and linux, and I use a Windows system. My boss distributes his meeting agenda and minutes as an extensionless file, so I would sulk all meeting long cursing his name until I found your info. This little tip + Notepad2 for file encoding conversion linux/windows has made my life a lot easier!
Perishable – #8
Excellent — glad to be of service! Thank you for the positive feedback.
Snappy! – #9
And while you are at it, install notepad++ … a GNU text editor that is like notepad on steroids! :)
David McRitchie – #10
Since the hosts file is the only such extensionless file i want to edit, I simply created a hostsx.bat file to bring it up in notepad and I don’t have to go into any folder to find it either.
Perishable – #11
David,
That sounds like a great idea! Perhaps you would be so kind as to share the
.batcode (no pun intended)?Jeff
David McRitchie – #12
The bat file (hostsx.bat) I use in Win 2000 is:
notepad C:\WINNT\system32\drivers\etc\hosts
Best reference and suggested entries for hosts file:
http://www.mvps.org/winhelp2002/hosts.htm
Where hosts file resides:
Windows Vista = C:\WINDOWS\SYSTEM32\DRIVERS\ETC
Windows XP = C:\WINDOWS\SYSTEM32\DRIVERS\ETC
Windows 2K = C:\WINNT\SYSTEM32\DRIVERS\ETC
Win 98/ME = C:\WINDOWS
Perishable – #13
Thank you for sharing this information with us.. Although I have already configured my primary computer to open all extensionless files with notepad (via the method described in the above article), I am looking forward to trying this new, expedient "hostsx.bat" method on my trusty laptop (running Win98SE). Definitely an excellent tip that could really speed things up around here.
Thanks again!
c.emery – #14
I found this site while looking for a solution to the hosts file editing annoyance. Since this is the only extensionless file I edit regularly, I don’t necessarily want to map them all to notepad (though I did find my solution here :).
My initial idea was to create a shortcut that opened hosts with notepad (I use winXP) - something like notepad C:\WINNT\system32\drivers\etc\hosts
This returned a dialog box saying hosts.txt didn’t exist, and asked if I wanted to create it. Modifying the argument to the notepad command by adding the “.” after hosts does the trick nicely though: notepad “C:\WINNT\system32\drivers\etc\hosts.”
No more open with. Thanks perishable.
Perishable – #15
c.emery,
Very nice! The comments now officially have become more informative than the original article. Thank you for contributing your insights with us — you are too kind!
Jeff
hJJ – #16
Looking for something like this for years … it was extremely annoying indeed (and typical Windows in the same time). Now looking for something that links unregistered files to Notepad, by default. 99% of the “new” extensions (after FORMAT) are linked with Notepad ..
Jeff P – #17
Thanks for this! I used to have extensionless files registered to notepad on Win 98 (I think using asterisk as the filetype). I’m glad someone found a way to do it on XP.
Perishable – #18
My pleasure — thanks for the feedback! :)
SBW – #19
Thanks! This worked, but didn’t solve the problem I thought it would: searches for a word in a file don’t check files without extensions (silly me–I though associating files without extensions as text files would fix it). But I did finally find the fix:
http://support.microsoft.com/kb/309173
It is amazing how well they buried the check box to include unknown file types in searches. The fact that the indexing services options control searches with indexing turned off is just the start. I recommend following the instructions in the kb article even if you don’t want to change anything–just for the entertainment value!
Perishable – #20
Quote: “It is amazing how well they buried the check box to include unknown file types..”
SBW dropping an informative, insightful comment on your post: free.
Reading through ancient Microsoft documents just for the “entertainment value”: priceless.
:)
hobs – #21
**** YES.
Thank you for this, I work with notepad++ and I am always accidentally saving extensionless files, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you!
Perishable – #22
Absolutely, positively, my pleasure — thanks for the feedback, hobs! ;)
Trackbacks / Pingbacks