Jump to content
Science Forums

Windows File Association Tutorial


alexander

Recommended Posts

Win admin by day, i have to deal with this crap sometimes, so i wrote up a, what i believe to be a neat tutorial, though its not the type of stuff i would post on my website, it would fit fine here :hyper:

 

This works as well for Terminal Server (and i wrote this for that reason) as it does on your regular home system, commands are the same, principals are too, and so forth.

 

File association on Windows Server or other operating system is a global setting, thus has to be approached very carefully and thoughtfully.

 

There are two utilities to assist you with this (both command line):

assoc and ftype

 

assoc - associates an extension to a association defined in ftype

ftype - associates an ftype name to a program

 

Why two utilities? Simple, one ftype can point to many associated extensions, DWF viewer, for example points to both a .dwf file and .dwfx, thus you will likely have more associations then file types.

 

How to facilitate associating a file:

 

First you want to look at what kind of values, the extension is associated with. Open up command prompt and run assoc (no arguments). You are now presented with the list of all of the extensions your computer/server knows. Scroll up or down to find the one in question, or lack thereof.

 

If you find the extension, note where it points.

ex: .txt=TextFile

 

Now run ftype (no arguments); this will list the association of the second part of the previous command, to the actual program. Scroll up/down to find your file type association.

ex: TextFile=WinWord.exe "%1"

 

Now the fun stuff:

If you want to disassociate an extension, simply run assoc with the extension equal to nothing

ex: assoc .txt=

 

if you want to change the associated program, run ftype with the already named association and point it to a different application, note follow the program with a "%1" which will, upon execution of the command, insert the first argument (aka the file name) and append it to the end of the command.

 

ex: ftype TextFile="C:Program FilesCrazy Text Editoreditor.exe" "%1"

 

If you want to create a new extension, or change another one, you can now point to the program association

ex: assoc .text=TextFile

 

Any file that ends with .text, and .txt will now be opened in the "Crazy Text Editor"

 

Note: BE EXTREMELY CAREFUL WITH THIS, YOU CAN REALLY MESS UP YOUR SYSTEM!!!

Link to comment
Share on other sites

Lol then switch to Linux, because you will understand the inner workings a lot more, if you deal with them for a while :hyper:

 

when you start reading up on paging algorithms, on file systems, on memory management, on preemptive algorithms, oh, also subscribe to the Linux Journal and read their df -u section, and research anything you dont understand in it (its all about upcoming changes and projects within the linux kernel)

Link to comment
Share on other sites

Note: BE EXTREMELY CAREFUL WITH THIS, YOU CAN REALLY MESS UP YOUR SYSTEM!!!

Uh, yup! :singer:

 

...which is really why I'd tell anyone who did not have some significant OS expertise to forget everything that alex just said, and just go to Windows Explorer and select Tools -> Folder Options -> File Types and then use the interactive interface, which although not terribly intuitive, does all the same stuff.

 

Just don't delete anything or change anything without double checking what the existing associations are! :cheer:

 

Beware of programmers who carry screwdrivers, :singer:

Buffy

Link to comment
Share on other sites

:singer:

Windows Explorer and select Tools -> Folder Options -> File Types and then use the interactive interface, which although not terribly intuitive, does all the same stuff.

it does, until you reach a terminal server and do a ftype to find out that pdf points to f0000e3 and then you go, oh so that's why the file association was not working for everyone.... oookay then... lets me fix it the right way :singer:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...