Jump to content


Photo
- - - - -

Windows File Association Tutorial


  • Please log in to reply
4 replies to this topic

#1 alexander

alexander

    Dedicated Smart-ass

  • Members
  • PipPipPipPipPipPipPip
  • 5722 posts

Posted 28 August 2008 - 06:26 AM

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!!!

#2 DougF

DougF

    Hypo Contributer

  • Members
  • PipPipPipPipPipPipPip
  • 1229 posts

Posted 28 August 2008 - 07:03 AM

Thanks for the information alexander,
I really want to understand the inter most workings of my computer.

#3 alexander

alexander

    Dedicated Smart-ass

  • Members
  • PipPipPipPipPipPipPip
  • 5722 posts

Posted 28 August 2008 - 07:32 AM

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)

#4 Buffy

Buffy

    Resident Slayer

  • Administrators
  • 8946 posts

Posted 28 August 2008 - 11:59 AM

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

#5 alexander

alexander

    Dedicated Smart-ass

  • Members
  • PipPipPipPipPipPipPip
  • 5722 posts

Posted 29 August 2008 - 10:31 AM

: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: