Amait
Amait

Reputation: 134

Is there a way to let my "File association" not to be opened by the application?

I have done some File associations for my project. it generates a number types of Files. however after deployment, when the files generated by the application are clicked they "open"/"run" the application, how do I disable that?

Bottom line I don't want it to "run" the application for me.

Thank you in advance I'm using C# Visual Studio 2010

Upvotes: 0

Views: 132

Answers (2)

GETah
GETah

Reputation: 21419

There are two angles from where you could tackle this problem:

  1. In the client machine, your setup program can change and reset the file association in the windows registry
  2. When Explorer opens a file with your application, it calls the program with the file as an argument. Your application can check if there are arguments provided in which case you can just exit your application or display an error message

Upvotes: 0

BluesRockAddict
BluesRockAddict

Reputation: 15683

You can do that in command line by running assoc .<ext> = "" command :

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\User>assoc .txt
.txt=txtfile

C:\Documents and Settings\User>assoc .txt = ""
.txt = ""

C:\Documents and Settings\User>

You could also create a batch file that clears out all the extensions you need.

Upvotes: 2

Related Questions