HOW TO: Use the ASSOC Command to Display and Modify File Name Extension Associations in Windows 2000 (323526)



The information in this article applies to:

  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Advanced Server
  • Microsoft Windows 2000 Professional

This article was previously published under Q323526

SUMMARY

This step-by-step article describes how to use the assoc command to display and modify file name extension associations on a Microsoft Windows 2000-based computer.

You can view or edit file name extension associations by using the assoc command or in Windows Explorer when you click Folder Options on the Tools menu, and then click the File Types tab. The format that is used to display the file types may differ depending on which method you use. For example, the "txtfile" file type that is used by the assoc command is displayed in Windows Explorer as "Text Document".

back to the top

Overview of the ASSOC Command

The assoc command uses the following syntax:

assoc [.ext[=[FileType]]]

The parameters used by the assoc command are:
  • .ext: Use this parameter to specify the file name extension whose association you want to view or change.
  • FileType: Use this parameter to specify the file type with which you want Windows to associate the specified file name extension.
back to the top

How to Display Current File Name Extension Associations

To view current file associations, do any of the following:
  • To display a list of current file associations, type assoc at the command prompt, and then press ENTER.

    A list of file name extensions and their current file type associations is displayed in the Command Prompt window.
  • To display a list of current file associations one screen at a time, type assoc |more at the command prompt, and then press ENTER.
  • To display a list of current file associations and redirect the output to the C:\Assoc.txt file, type assoc > c:\assoc.txt at the command prompt, and then press ENTER.
  • To display the current file type association for a specific file name extension, type assoc .ext, where .ext is the extension whose association you want to view, and then press ENTER. For example:
    • To view the current file type association for .doc files, type assoc .doc at the command prompt, and then press ENTER. For example:
    • To view the current file type association for .htm files, type assoc .htm at the command prompt, and then press ENTER.
back to the top

How to Edit File Name Extension Associations

To edit a file association, type assoc=FileType, where FileType is file type that you want to associate with the extension, and then press ENTER. For example:
  • To change the current file type association for .htm files to Text Document (txtfile), type assoc .htm=txtfile at the command prompt, and then press ENTER.

    The following line is displayed in the Command Prompt window:

    .htm=txtfile
    						

  • To change the file type association for .htm files to HTML Document (htmlfile), type assoc .htm=htmlfile at the command prompt, and then press ENTER.

    The following line is displayed in the Command Prompt window:

    .htm=txtfile
    						

back to the top

REFERENCES

For more information about the assoc command, type assoc /? at the command prompt, and then press ENTER.

For additional information about how to modify file associations in Windows 2000, click the article number below to view the article in the Microsoft Knowledge Base:

320033 HOW TO: Change File Associations in Windows 2000

back to the top

Modification Type:MajorLast Reviewed:11/19/2003
Keywords:kbhowto kbHOWTOmaster KB323526 kbAudITPro