ASSOC Command

Assoc command to change file extension association.

Assoc command to Display or change the association between a file extension and a fileType.

ASSOC .ext = [fileType]

.ext : The file extension
fileType : The type of file

last few characters in a FileName after the period(.) is called a file extension.
Ex.. XYZ.HTML has the file extension .HTML

The File extension is used by Windows NT to determine the type of information stored in the file and therefore which application(s) will be able to display the information in the file. File extensions are not case sensitive and are not limited to 3 characters.

More than one file extension may be point to the same File Type.
e.g. both the extension .Tif and the extension .Tiff may be point to the File Type “TifImage”

At any one time a given file extension may only be associated with one File Type.
e.g. If you change the extension .TIFF to the File Type “txtfile” then it’s normal association with “TifImage” will disappear.

File Types can be displayed in the Windows Explorer GUI: [View, Options, File Types] however the output is usually different to that expected by the command e.g. the File Type “txtfile” is displayed in the GUI as “Text Document”

The ASSOC command followed by just a file extension will display the File Type for that extension.
ASSOC command without any parameters will display all the current file associations.

Assoc command with “.ext=” will delete the association for that file extension.

if you have clicked Always Use This Program To Open This File option turned on then you can change it back so it prompts you to specify a program each time, just delete the association for that file type.

ASSOC .ext=
[where .ext is the file extension].
Now when you double-click on a file of that type, the system will ask you what program you want to use.

Using the command will edit values stored in the registry at HKey_Classes_Root\.


View file associations:
ASSOC .jpg

Add file associations:
ASSOC .jpg=jpegfile

Delete a file association:
ASSOC .jpg=

Digging through CLASSES_ROOT entries sometime reveals more than one shell for the same application, for example [open] and [play] these may have differences, changing the default action for a file extension may even invoke a different executable.