Creating file association from a command line.

Posted on 2005-05-13
Last Modified: 2008-01-09
I have several clients running windows xp home addition.  They use Microsoft Office Document Imaging to view incomming faxes from the internal website on our Windows SBS 2k3 (MSPVIEW.EXE).  The problem is certain apps keep steeling the file associations for the .tif files.  My useers are not very technically savy and they are not onsite so I need to know if there is a way to reassociate MSPVIEW.EXE with tif files through a command line or by adding a registry key.  this way I could simply write a simple cmd file and make an icon for them to run whenever it breaks.  This issue needs to be resolved pretty quickly so I am going to give it a high point value.
Question by:allanhendershot
    LVL 82

    Accepted Solution

    To do that from the command line, you need two things:
    * an association from the extension to a document type
    * a file type, telling the OS which program to start with the extension

    For the former, you need the command "assoc":
    C:\>assoc .tif

    For the latter, you need the command "ftype":
    C:\>ftype mspaper.document
    mspaper.document="C:\Program Files\Shared Data\Microsoft Shared\MODI\11.0\MSPVIEW.EXE" "%1"

    So to set the .tif associtation back to the original, use a small batch script.
    Verify the correct association name and program path by entering the commands above, and use those; it should look similar to that:

    @echo off
    assoc .tif=MSPaper.Document
    ftype mspaper.document=C:\Program Files\Shared Data\Microsoft Shared\MODI\11.0\MSPVIEW.EXE" "%1"

    Author Comment

    Perfect.  Worked like a charm. Thank you.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Suggested Solutions

    Occasionally Windows/Microsoft Updates will fail to update. We have found a code that will delete all temporary files and re-register all dll's related to Windows/Microsoft Updates! This works 99% of the time to get the updates working again! The…
    Sometimes a user will call me frantically, explaining that something has gone wrong and they have tried everything (read - they have messed it up more and now need someone to clean up) and it still does no good, can I help them?!  Usually the standa…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now