ASSOC - CMD
Overview
The ASSOC
command in Windows CMD is used to view or modify file extension associations. This command displays or changes the association between a file extension and the file type (defined by the program used to open the file). The ASSOC
command is particularly useful for troubleshooting file association problems or for batch scripting to ensure consistent software behaviors across different systems.
Syntax
The basic syntax for the ASSOC
command is:
ASSOC [.ext[=[fileType]]]
.ext
: Specifies the file extension to associate with the file type.fileType
: Defines the file type to associate with the file extension. IffileType
is omitted, the command will delete the association for the file extension.
Options/Flags
- No specific options/flags: The
ASSOC
command itself does not include additional flags. Its functionality is primarily controlled through the arguments passed to it (the file extension and the file type).
Examples
-
View all associations:
ASSOC
This command lists all current file type associations.
-
View the association of a specific file extension:
ASSOC .txt
Displays the file type associated with
.txt
files. -
Set an association for a file extension:
ASSOC .txt=txtfile
This example associates
.txt
files with thetxtfile
file type. -
Delete an association:
ASSOC .txt=
Removes the association for
.txt
files.
Common Issues
- Incorrect file association: Sometimes setting or altering file associations incorrectly can lead to files opening in the wrong programs. Always verify changes by opening a file with the extension you modified.
- Permission issues: Modifying file associations in system-wide contexts may require administrative privileges.
Integration
The ASSOC
command can be combined with the FTYPE
command to manage how file types are handled:
ASSOC .pl=PerlScript
FTYPE PerlScript=perl.exe %1 %*
This sequence first associates .pl
files with PerlScript
, then specifies that PerlScript
file types should be opened with perl.exe
.
Related Commands
FTYPE
: Sets or gets the file types used in file extension associations.START
: Opens a file or program, which can test the functionality of new or modified file associations.
For further readings and more detailed documentation, you might visit the official Microsoft command-line reference.