DOS lives! Secrets of the Windows command prompt

Don't be afraid of a little typing. Lots of good old DOS commands still work in Windows, and often they're the best choice for quick and efficient work.

1 2 3 4 5 6 7 8 Page 6
Page 6 of 8

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:


To view it in Notepad:


Each entry takes the format of


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:


This command directs ASSOC to output any files associated with the JPG extension. On my screen, I saw this output:


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:


The format for each line that FTYPE displays works like this:


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:


On my computer, I see the following command for dealing with JPEGFILE types:


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


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:


1 2 3 4 5 6 7 8 Page 6
Page 6 of 8
7 inconvenient truths about the hybrid work trend
Shop Tech Products at Amazon