Finding file associations
The two commands used for file associations are ASSOC
and FTYPE
. You need two commands because there are two steps to file association: The first step, handled by ASSOC
, is to associate a filename extension with a file type. The second step, handled by FTYPE
, is to associate the file type to the command that opens the file. (Yes, Windows uses DOS command lines to open files. Now you can too.)
By itself, the ASSOC
command lists every registered filename extension and the type of file it's registered to. The output scrolls by super fast. To get a full list, I recommend printing it or saving to disk and examining the list in Notepad.
To print the list, type:
ASSOC > PRN
To view it in Notepad:
ASSOC > ASSOC.TXT
NOTEPAD ASSOC.TXT
Each entry takes the format of
.ext=type
Where ext
is the filename extension (complete with period), and type
is the name of a file type. For example, to see how JPG files are registered, use this command:
ASSOC .JPG
This command directs ASSOC
to output any files associated with the JPG extension. On my screen, I saw this output:
.jpg=jpegfile
Filenames ending in .JPG are associated with the JPEGFILE type.
As with ASSOC
, the output from the FTYPE
command is voluminous and scrolls by too quickly to see. You can redirect the output to a file and examine it in Notepad by issuing these two commands:
FTYPE > FTYPE.TXT
NOTEPAD FTYPE.TXT
The format for each line that FTYPE
displays works like this:
type=command
where type
is an associated file type that the ASSOC
command outputs, and command
is the command line instructions for opening the given type. Windows opens the file using batch file command line arguments, such as %1
for the filename to open, then %2
through %9
for any additional command-line arguments.
You may also see various command-line switches specified in the command part of FTYPE
's output. (This is how some of those so-called computer geniuses discover "secret" or "hidden" switches.)
As an example, you can see how Windows treats the JPEGFILE file type:
FTYPE JPEGFILE
On my computer, I see the following command for dealing with JPEGFILE types:
%SYSTEMROOT%\SYSTEM32\RUNDLL32.EXE "%PROGRAMFILES%\WINDOWS PHOTO GALLERY\PHOTOVIEWER.DLL", IMAGEVIEW_FULLSCREEN %1
The command may look confusing, but it's not. Remember: Full pathnames are used, so it's really just four items you see altogether. Initially, there's
%SYSTEMROOT%\SYSTEM32\RUNDLL32.EXE
where %SYSTEMROOT%
is a variable that expands to represent the location where you've installed Windows on your PC. The RUNDLL32.EXE
program runs processes in Windows. In this case, it's running the Windows Photo Gallery Photo Viewer program:
"%PROGRAMFILES%\WINDOWS PHOTO GALLERY\
PHOTOVIEWER.DLL",