fortypoundhead.com

ASSOC

Posted On 2005-11-1 by FortyPoundHead
Keywords: Command Reference
Tags: Windows Commandline Windows
Views: 1602


ASSOC

Display or change the association between a file extension and a fileType



syntax

ASSOC .ext = [fileType]



ASSOC



ASSOC .ext



ASSOC .ext =



key

.ext : The file extension

fileType : The type of file



A file extension is the last few characters in a FileName after the period. So a file called JANUARY.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 associated with the same File Type. e.g. both the extension .JPG and the extension .JPEG may be associated with the File Type "jpegfile"



At any one time a given file extension may only be associated with one File Type. e.g. If you change the extension .JPG so it is associated with the File Type "txtfile" then it's normal association with "jpegfile" will disappear. Removing the association to "txtfile" does not restore the association to "jpegfile"



File Types can be displayed in the Windows Explorer GUI: [View, Options, File Types] however the spelling is usually different to that expected by the ASSOC command e.g. the File Type "txtfile" is displayed in the GUI as "Text Document"and "jpegfile" is displayed as "image/jpeg"



The command ASSOC followed by just a file extension will display the current File Type for that extension.



ASSOC without any parameters will display all the current file associations.



ASSOC with ".ext=" will delete the association for that file extension.



Did you leave the Always Use This Program To Open This File option turned on? To change it back so it prompts you to specify a program each time, just delete the association with 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 ASSOC command will edit values stored in the registry at HKey_Classes_Root\.

Therefore it's possible to use registry permissions to protect a file extension and prevent any file association changes.



Examples:

Viewing file associations: ASSOC .txt

ASSOC .doc

ASSOC >backup.txt



Editing file associations: ASSOC .txt=txtfile

ASSOC .DIC=txtfile

ASSOC .html=Htmlfile



Deleting a file association: ASSOC .html=




About the Author

FortyPoundHead has posted a total of 1974 articles.

 


Comments On This Post

No comments on this post yet!


Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.


Your IP address is:54.198.108.19

Before you can post, you need to prove you are human. If you log in, this test goes away.




Recent Forum Posts

VBScript Formatting String Text
Williamhawk posted on November 21, 2017 at about 2:54 in VBScript

Is There a Media Player for Linux Which Can Play
Williamhawk posted on November 21, 2017 at about 2:50 in Linux Help

Advanced search added
dwirch posted on September 23, 2017 at about 13:44 in Site News

Job Spammer: Gaurav Mehta - AgreeYa Solutions
dwirch posted on September 22, 2017 at about 10:35 in Spammers

Job Spammer: Prutha Siri - Javelin Systems
dwirch posted on September 10, 2017 at about 6:15 in Spammers

New security implemented
dwirch posted on September 7, 2017 at about 7:16 in Site News