The ability to associate a file type with a program in Windows via the command line is a fairly simple task. In order to do so, the user must use the Windows utility, “assoc”.
This command allows the user to map a file extension to the program that should open it when double clicked. To use this command, open the command prompt and type in the following command:
assoc “[file extension]”=”[program to open it]”
For example, to associate an MP3 file with Windows Media Player, the command would be:
The “wmpfile” command specifies that Windows Media Player should be the default program to open the file.
In addition to associating a file type with a program, the “assoc” command can also be used to remove a file association. To do this, the user must use the following command:
assoc “[file extension]”=””
For example, to remove the file association for an MP3 file, the command would be:
Once the command is executed, the file type will no longer be associated with any program.
The “assoc” command is an incredibly powerful tool that can be used to quickly and easily manage file associations in Windows. By using this command, an IT admin can easily control what program opens a file type, or even remove a file association altogether. This can be especially useful when a user has a file type that is not associated with any program, or if the user wishes to change the default program for a file type.