The command: "ASSOC" is on Windows 12, 11, 10, .. , MS Server 2025, 2022, 2019, .. available
The examples for the command "ASSOC"
Here are examples with comments for the
`ASSOC` command in the Windows Command Prompt:
Example 1: Map file type to file extension show:
ASSOC
This command displays all current file type to file extension associations. For example, the file extension
".txt" is associated with a text document, and the association may be labeled
"txtfile".
Example 2: Show mapping for a specific file extension:
ASSOC .txt
This command displays the current mapping for the
".txt" file extension. It is displayed which file type this file extension is assigned to, such as
"txtfile".
Example 3: Change mapping for a file extension:
ASSOC .xyz=MyApplication
This command changes the mapping for the file extension
".xyz". In this example,
".xyz" is associated with the application
"MyApp".
Example 4: Delete association for a file extension:
ASSOC .xyz=
Here the assignment for the file extension .xyz is deleted. This means that Windows will no longer automatically try to open a specific application with files of this extension.
Example 5: Save all assignments to a text file:
ASSOC > Assignments.txt
This command saves all current file type-to-extension associations to a text file called associations.txt. The file contains information about which file types certain file extensions are assigned to.
Example 6: Save specific mappings to a text file:
ASSOC | FIND "txt" > TextFilesAssignments.txt
Only the assignment for file extensions that contain the character string txt is saved here. This could be useful for getting specific information about text file associations.
"ASSOC" Excerpt from Microsoft Windows Help
Microsoft Windows [Version 10.0.19045.3693]
(c) Copyright 1985-2023 Microsoft Corp.
C:\\WINDOWS>
Displays or modifies file extension associations
ASSOC [.ext[=[fileType]]]
.ext Specifies the file extension to associate the file type with
fileType Specifies the file type to associate with the file extension
Type ASSOC without parameters to display the current file associations.
If ASSOC is invoked with just a file extension, it displays the current
file association for that file extension. Specify nothing for the file
type and the command will delete the association for the file extension.
Important information, tips for the "ASSOC" command
Yes, there are some important points to note when using the `ASSOC` command in Windows Command Prompt:
1. Administrative Privileges:
Make sure you have administrative permissions if you want to change or delete file type associations. The command may require elevated privileges to make changes to the system.
2. Be careful when changing mappings:
Changing file type associations may cause files to no longer open as expected. Make sure you understand the changes and only make them if you know exactly what you are doing.
3. Backup of mappings:
Before making any changes, it is advisable to create a backup of the current mappings. This can help you revert to a previous state if something goes wrong. You can save the output of `ASSOC` to a file as shown in Example 5.
4. Note syntax:
Be sure to use correct syntax. The `ASSOC` command is typically used with file extensions and file types. Disregarding the syntax can lead to unexpected behavior.
5. Use of `FTYPE` command:
In conjunction with `ASSOC`, the `FTYPE` command can also be used to change the command or program that is run on a specific file type. This might be relevant if you want to make deeper changes.
6. Restart may be required:
Sometimes changes to file type associations only take effect after a system restart.
It is always advisable to be careful and be aware that changes to file type associations can affect system behavior. If you are unsure, you may want to seek professional help or do further research to ensure you get the results you want.