Associate Any File with Notepad
Open the Windows command prompt and enter the following command:
assoc .extension=fileType
It’s that easy. What is happening here? Let’s break it down, just for fun:
assoc— Windows file-association command.extension— the extension of the file for which you would like to associatefileType— the type of file that you would like to associate with your extension
Some amazing and useful facts about the assoc function:
- Type the command “assoc” without parameters to display a list of current file extensions
- Any fileType value shown in the aforementioned list of file extensions may be used for your files
- If the assoc command is run with only the file-extension parameter, the function will return the current file association for that file extension
- If nothing is specified for the fileType, the assoc function will delete the association for the given file extension
- To learn more about the assoc function, enter the following command via the Windows command prompt:
assoc/?
Here are some common fileTypes that may be useful (for an entire list, enter the “assoc” command without parameters) — you know, because you may want to open your files in something other than Notepad (although I don’t see why you would):
wrifile— opens in WordPadWord.RTF.8— opens in MS WordWord.Document.8— opens in MS Wordhtmlfile— opens in your default browser
Sound good? Let’s check out a few examples.
Associate extensionless files with Notepad
Here’s how to associate extensionless files with Notepad in one swift stroke:
assoc .=txtfile
And done. Testing this method is easy because the association command works on any file. To check it, create a new file named something without an extension (e.g., “pancakes”). You will see the default Windows icon designating an unknown file type. Now run the command given above. Presto change-o rearrange-o! Your new extensionless file is now magically associated with Notepad. Go ahead, double-click on it and watch it open! Amazing :)
Associate other file types
Just because I am having so much fun with this little tutorial, let’s check out a few more examples of files that are common to us web-developer types.
.xml files
For some reason, Photoshop insists on claiming all XML files on my system. This is ridiculous, of course, but the situation is now resolved thanks to the following command:
assoc .xml=txtfile
Now, rather than launching Photoshop when I click open an XML file, the file appears instantly and ready-to-edit in Notepad. Ahhh, what a relief! :)
Raw access log files
Checking your site’s access logs involves dealing with files that are named after your domain. For example, the access logs for djrohan are named “djrohan.com”. This is fine for the server, but sadly Windows is not familiar with extensions like, “.com”, “.net”, “.org” and so on. So, rather than tediously renaming my log files, I run the following commands and call it done:
assoc .com=txtfile
assoc .net=txtfile
assoc .org=txtfile
.htaccess files
This technique is perfect for HTAccess files. Off the truck, Windows can’t handle nameless files with the crazy .htaccess extension. Fortunately, we can teach Bill’s beast a little respect:
assoc .htaccess=txtfile
![Associate .htaccess files with Notepad via the command line [ Windows Command Prompt ]](http://www.djrohan.com/blog/wp-content/uploads/HLIC/2d3dc7ef8b4435827157f364196beb98.gif)
Pow! In your face, Microsoft!!! ;)
Dropping Skullz
As mentioned in the dazzling intro, this method works great for associating any type of file (i.e., any file extension) with Notepad. For web developers and designers working with the Windows operating system, this simple command-line trick is immensely helpful when dealing with the wide variety of unusual file types commonly associated with server configuration and management. Here are a few examples of files types that Windows just can’t handle without explicit instruction:
.htaccess.ftpquotamutex.lockdomain.tldmime.typeshttpd.confcache (no extension)
Now, rather than wasting time fighting your way through a right-click and two or three dialogue boxes every time you need to open an unknown file type in Notepad, take a few seconds to execute a simple Windows command and forget about it. Nothing could be easier!
Related Posts
Related posts:
- Use Notepad As A Diary
- Run EXE Files As JPG, PNG, GIF Or Under Any Different Extension
- Recover Information From Any Corrupt File
- How to open Tabs in Notepad?
- SPEED UP UR ACROBAT READER (ALMOST LIKE NOTEPAD)
- Windows 7/Vista: Compressed File Option Missing From Send Menu
- Lock Folders Using Notepad
- Fix for Very Slow or Hang When Right Click On a File or Folder









Leave your response!