How to create and delete a custom file association

We would need to create a create a custom file association for a custom file extension called .cfe.

The program we need to associate it with is also a custom program living locally on our machines (custom_app.exe).

Now, there is no problem with that except that we need the program to call the .cfe file with a "-f" argument like so:

custom_app.exe -f file.cfe

Looking all over, I cannot find a way to add the "-f" argument key.

By default, Windows will create the association like this "custom_app.exe %1", which does not work.

So where can we manage not only the association itself, but the arguments details ?

Also, as long as we are there, where is the delete function for file associations ?

It seems to have disappeared completely since Windows 7.

Thanks.

* Please try a lower page number.

* Please enter only numbers.

* Please try a lower page number.

* Please enter only numbers.

The only built in way is using a command prompt and the assoc command (here shown in Windows 7 but it's the same in all newer versions).

I use a little utility called Types that gives basically the kind of fine-grained editing that you might have seen back in Windows NT/2000:

Shawn "Cmdr" Keene | Microsoft MVP - Windows Insider | CmdrKeene.com | tweet me: @LtCmdrKeene
Microsoft MVPs are independent experts offering real-world answers. Learn more at mvp.microsoft.com.

3 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi Shawn.  Thanks for the feedback.

But there are a few things I would like to understand.

Using the assoc command, I can see 2 things:

  1. It is not clear what the association is using that command
  2. Not all associations are shown using that command

1-

On #1, for the common .pdf association, what we can see is:

What is that AcroExch.Document.DC about or coming from ?

We can deduce that it may be related to Acrobat Reader, but then who knows what that is really.

2-

On #2, I do have an association for .php files with Notepad++:

but using the assoc command shows nothing:

Why ?

Does the assoc command only reports system wide associations and not user based associations ?

That said, I also created another association for .css files in the exact same way as for the .php files, and this one shows up:

Why ?

And again, we have no clue what CSSfile really means.

3-

I tried to use the "delete" function ("assoc .css=nothing"), and it came back with:

Accès refusé.
Une erreur s’est produite lors du traitement de : .css.

It's in French, but it would show in English as:

Access denied.

An error occured while processing: .css

What is that about ?

This is not a system association.

This is an association I did create myself.

4-

Finally, I tried to look at the Types utility but using the lik you provided, it does not work.  It says :

The link is missing

But what is even more surprising is why we have to rely on an external utility for this basic file association task.

It should simply be available in Windows.  Right ?

In summary, this is a sad story about something so simple that it should simply be available in Windows.

Mr Microsoft ?  Why is it not simply there ?

Thanks.

1 person found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Well I can't tell you why it's not there. I'm sure there's reasons, but we don't have internal access to the decisions that happened over a decade ago when the feature got removed from the OS.  As for your access-denied, it's likely you can run the command prompt as an administrator so you aren't restricted.  You can also type assoc /? to see the syntax and instructions for how to use the command, or here's a link to the Types tool that I use.

Shawn "Cmdr" Keene | Microsoft MVP - Windows Insider | CmdrKeene.com | tweet me: @LtCmdrKeene
Microsoft MVPs are independent experts offering real-world answers. Learn more at mvp.microsoft.com.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi Shawn.  Thanks for your reply and sharing the Types application installer.

However, we would still like to get answers to our questions.

Yes, maybe the assoc could remove the association as an administrator, but as a regular user, who created that association myself as a regular user, I don't have access to that.

Hopefully, someone else can look at our questions and provide some specific answers.

Because the way it is now, Microsoft does not provide the proper toolset to completely manage file associations.

That's something that is long overdue to be fixed.

Thanks.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

For the record, I just found where some application call is defined for file association:

  • HKEY_CLASSES_ROOT\Applications\Application_Name\shell\Application_Command\command

where Application_Name is the exe application name like notepad.exe or AcroRD32.exe

and Application_Command is the command string shown for that application association like "open", "edit" or "print".

Each definition has a default REG_SZ entry where the full path exact command to execute is defined.

There can also be another "logical" entry, like for AcroExch.Document.DC that is equivalent to the one just mentioned above:

  • HKEY_CLASSES_ROOT\AcroExch.Document.DC\shell\Open\command

Not sure why this doubled and which one has priority over the other.

And yet, I also looked at those registry keys for .css, and they do not follow that model:

Neither HKEY_CLASSES_ROOT\Applications\.css or HKEY_CLASSES_ROOT\CSSfile have the notepad++ command definition within those keys.

But .css does have HKEY_CLASSES_ROOT\.css\Content Type which is defined as text/css.

Maybe that's another style of file association definition ?

Food for thought ?

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

The same kind of definitions can also be visible under HKEY_CURRENT_USER\Software\Classes.

And there is some other deifintions under HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts and HKEY_USERS\User_Internal_ID\Software\Classes.

It would be interesting if someone could explain the differences between all those seemingly redundant file association definitions.


Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Yes you can set it by both extention or the file's perceived type.  For example .gif, .png, and .bmp are all perceived types of "picture", and that entire class can be associated all at once.

See: How File Associations Work and File Types and File Associations which will give you the background you need.


Including...

Also Best Practices for File Associations, including the very important Do Not Copy File Associations from the Registry and Avoid Hard-Coding Paths into the Registry Where Possible articles.  Windows 10, also, will revert back any changes made improperly to the registry.  


The Guidelines for File Associations and Default Programs also has good examples if you need some. 

Shawn "Cmdr" Keene | Microsoft MVP - Windows Insider | CmdrKeene.com | tweet me: @LtCmdrKeene
Microsoft MVPs are independent experts offering real-world answers. Learn more at mvp.microsoft.com.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Wow.  That's a lot of MSDN documentation to look at.  Thanks for the references.

Most likely, looking at all those documents should allow for someone to find and document valid workarounds for managing file associations directly in the registry.

But at the same time all those documents will not solve our problems of having full management capabilities of file associations in Windows.  And that's what we are looking for.

Understanding that Windows is missing some core file associations management capabilities, what is the best method to get Microsoft's attention so they can fix those management issues sooner than later ?

Because everyone should agree that having to either play with the registry directly or having to download external utilities for such basic features should be unacceptable to the community and Microsoft.

So how can we get Microsoft to fix this sooner than later ?

Thanks.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Essentially put it in the built-in Feedback app (look for it in your Start menu) and get others to "vote" on it.  But I doubt it will happen.  Maybe I'm just a pessimist but I think that they probably assume that the existing abilities meet enough needs for typical users to associate a file with a program for most users, and advanced editing should be done using the instructions on MDSN or with another tool tuned for the task.
Shawn "Cmdr" Keene | Microsoft MVP - Windows Insider | CmdrKeene.com | tweet me: @LtCmdrKeene
Microsoft MVPs are independent experts offering real-world answers. Learn more at mvp.microsoft.com.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Looks like Shawn gave you most of the info on this stuff. Adding my 2 cents.

#1: Run:

FTYPE  AcroExch.Document.DC

That'll tell you the executable assigned for the Programmatic Identifier named "AcroExch.Document.DC"

#2: You're correct. Assoc and Ftype wouldn't consider the "User choice" made either using Open with or "Default Apps" / "Default Programs", which would be written underneath the "Fileexts" registry key.

(If you want to see the complete FTA dump, get FileTypeDiag by Leo Davidson. This tool will give you enough output to make our heads spin :) Just kidding, this tool is super awesome.)

#3: Assoc and Ftype need to be run from elevated Command Prompt. Also, to remove a file type association, use this example:

ASSOC .BAK=

That would remove the file extension from the registry. It's ProgID is not removed though. You need to use Ftype for that.

ex-MVP (2003-2012) (Windows Client)

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

* Please try a lower page number.

* Please enter only numbers.

* Please try a lower page number.

* Please enter only numbers.

 
 

Question Info


Last updated January 13, 2021 Views 4,711 Applies to: