Home > Commands A-M > Commands A

ASSOCIATE


Description | Syntax | Parameters | Switches | Related | Notes | Examples | Errorlevels | Availability

One step file association.

This utility does the job of both ASSOC and FTYPE, in one step. ASSOCIATE assigns an extension directly with an executable application. This is done by automatically adding a new FileType to the system registry.


Syntax

ASSOCIATE .ext filename [/q] [/d] [/f]


Parameters
.ext (NT4)
The file extension. A file extension is the last few characters in a FileName after the period. So a file called JANUARY.HTML has the file extension .HTML.
The File extension is used by Windows NT to determine the type of information stored in the file and therefore which application(s) will be able to display the information in the file. File extensions are not case sensitive and are not limited to 3 characters.
More than one file extension may be associated with the same File Type.
e.g. both the extension .JPG and the extension .JPEG may be associated with the File Type "jpegfile"
At any one time a given file extension may only be associated with one File Type.
e.g. If you change the extension .JPG so it is associated with the File Type "txtfile" then it's normal association with "jpegfile" will disappear. Removing the association to "txtfile" does not restore the association to "jpegfile"
File Types can be displayed in the Windows Explorer GUI: [View, Options, File Types] however the spelling is usually different to that expected by the ASSOC command e.g. the File Type "txtfile" is displayed in the GUI as "Text Document"and "jpegfile" is displayed as "image/jpeg"
filename (NT4)
Executable program to associate .ext with.

Switches
/d (NT4)
Delete - Delete the association.
Note that /d will delete the File Association but will NOT delete the File Type.
File types created by Associate.exe are always given a name in the form xxxfile, where xxx is the file extension.
/f (NT4)
Force - Force overwrite or delete without questions.
/q (NT4)
Quiet - Suppress interactive prompts.

Related

FTYPE - Edit file types (used in file extension associations)
ASSOC - Change file extension associations
Equivalent Linux BASH commands:
export - Set an environment variable


Notes

none.


Examples

Adding a File Association:

To add the File Type "SQLfile"=Notepad.exe and also set the File Association of .SQL="SQLfile" run this command:

    ASSOCIATE .SQL Notepad.exe

Removing a File Association:

    ASSOCIATE .SQL /d

Errorlevels

none.


Availability
External Resource Kit
DOS
none
Windows
none
Windows NT
NT4

Last Updated: 2003/07/28
Direct corrections or suggestions to: Rick Lively