Possible Duplicate:
How to associate a file extension to the current executable in C#
I dont know how exactly to call this issue.
I am looking for a solution such as: my .net application will be automatically opened when a filetyle defined for that application is open.
For example: the filetype of that application has an extension xyz: hellothere.xyz
Whenever, the user opens the file with an extension “xyz” then that .net application will be opened. How can I achieve this?
Thanks in advance.
A file association can be created manually in Windows Folder Options. This article describes how to do it programmatically, for example with a registry file:
Create a string key for your file extension in
HKEY_CLASSES_ROOTnamed.xyz.Set its value to the name of your file type, e.g.,
XyzDocument.Create a string key
HKEY_CLASSES_ROOT\XyzDocument\open\shell\command.Set its value to
"path\to\your\program" "%1"or similar, per your needs.You can also do it from a batch script with
ftypeandassoc: