Skip to content

ASSOC Windows command

The Windows assoc command is a useful tool that allows users to associate file extensions with specific programs and actions. By using the assoc command in the command prompt, users can easily manage the file associations on their system. This can be particularly helpful when dealing with files that are not opening in the desired program or when wanting to change default programs for specific file types. The assoc command displays the current file associations and allows users to create new associations or modify existing ones. By understanding how to use the assoc command, users can take control over how files are opened and processed on their Windows system.

Terminal window
assoc [.extension=[fileType]]
OptionDescription
.extension=Specifies the file extension to associate with the specified file type.
ParameterDescription
.extensionSpecifies the file extension to associate with a specific file type.
Terminal window
assoc .txt=txtfile

Associates the “.txt” file extension with the file type “txtfile”.

Displaying the File Type Associated with a File Extension

Section titled “Displaying the File Type Associated with a File Extension”
Terminal window
assoc .txt

Shows the file type associated with the “.txt” file extension.

Terminal window
assoc .txt=

Removes the association of the “.txt” file extension with any file type.

Terminal window
assoc

Displays a list of all file extensions and their associated file types.

Changing the File Type Associated with a File Extension

Section titled “Changing the File Type Associated with a File Extension”
Terminal window
assoc .txt=textfile

Changes the file type association of the “.txt” file extension to “textfile”.

Associating a File Extension with a Specific Program

Section titled “Associating a File Extension with a Specific Program”
Terminal window
assoc .docx=Word.Document.12

Associates the “.docx” file extension with the Microsoft Word program.

Restoring Default File Extension Associations

Section titled “Restoring Default File Extension Associations”
Terminal window
assoc .txt=txtfile

Restores the default association of the “.txt” file extension with the “txtfile” file type.

Terminal window
assoc /?

Shows the help information for using the assoc command.

To use the assoc command in CMD, execute the following command:

Terminal window
assoc

The assoc command in CMD displays or modifies file name extension associations. It is used to associate a file extension with a file type.

Terminal window
assoc .txt=txtfile

How can I list all file associations using assoc in CMD?

Section titled “How can I list all file associations using assoc in CMD?”

You can list all file associations by simply executing the assoc command without any parameters.

Terminal window
assoc

How do I remove a file association using assoc in CMD?

Section titled “How do I remove a file association using assoc in CMD?”

To remove a file association for a specific file extension, you can use the following command format:

Terminal window
assoc .txt=
  • Linking file extensions to specific file types and programs.