Purpose:Display, create, or delete file / command associations.

 

Format:ASSOCIATE [/= /D /F /P[n] /R [file...] /U /V:verb [.ext[=[command]]]

 

fileOne or more input files to read association definitions from.
.extThe file extension whose associated command you want to display or set.
commandThe executable command to run for the specified file extension

 

/D(elete)/R(ead)
/F(orce)/U(ser)
/P(ause)/V(erb)

 

See also: ASSOC, FTYPE, and Executable Extensions.

 

Usage:

 

You must be running in an elevated session to use ASSOCIATE (unless you're using the /U option).

 

ASSOCIATE combines the ASSOC and FTYPE commands. It allows you to create, modify, or display associations between file extensions and commands types stored in the Windows registry.

 

ASSOCIATE manages Windows file associations stored under the registry handle HKEY_CLASSES_ROOT (or HKEY_CLASSES_USER), and discussed in more detail under Windows File Associations. If you are not familiar with file associations be sure to read about them before using ASSOCIATE.

 

If you invoke ASSOCIATE with no parameters, it will display the current associations. If you include a .ext, with no equal sign or command, ASSOCIATE will display the command associated with that extension.

 

If you include the equal sign and command, ASSOCIATE will create or update the association for extension .ext to refer to the specified command.

 

ASSOCIATE should be used with caution, and only after backing up the registry. Improper changes to file associations can prevent applications and / or the operating system from working properly.

 

Options:

 

/=Display the ASSOCIATE command dialog to help you set the command line options. The /= option can be anywhere on the line; additional options will set the appropriate fields in the command dialog.

 

/DDelete the association for the specified .ext.

 

/FForce an overwrite of an existing association.

 

/P[n]Wait for a key to be pressed after each screen page before continuing the display. Your options at the prompt are explained in detail under Page and File Prompts. (Only useful when running ASSOCIATE with no arguments.) The /P option has an optional argument n that specifies the number of seconds to wait for a keystroke before continuing.

 

/RThis option loads an association list from a file. The format of the file is the same as that of the ASSOCIATE display:

 

.ext=command

 

where .ext is an extension, which is to be associated with command.

 

You can load multiple files with one ASSOCIATE /R command by placing the names on the command line, separated by spaces:

 

associate /r assoc1.lst assoc2.lst

 

You can insert comments in the file by prefixing the line with a colon (:).

 

ASSOCIATE /R will read from stdin if no filename is specified and input is redirected.

 

/UDisplay or set the association in HKCU\Software\Classes.

 

/V:verbASSOCIATE defaults to reading and writing to SHELL\OPEN\COMMAND. You can use a different verb by specifying the /V option. For example, to create a PRINT verb for .TXT files:

 

ASSOCIATE /V:PRINT .txt=%%SystemRoot%%\system32\NOTEPAD.EXE /p %%1

 

If you use * for the verb, ASSOCIATE will display all of the shell verbs and their commands for the specified extension.