How to change filetype association in the registry?

.net, c#, file-extension, registry

Solution

In addition to the answers already provided, you can accomplish this by calling the command line programs "ASSOC" and "FTYPE". FTYPE associates a file type with a program. ASSOC associates a file extension with the file type specified through FTYPE. For example:

FTYPE SMCFile="C:\some_path\SMCProgram.exe" -some_option %1 %*
ASSOC .smc=SMCFile

This will make the necessary entries in the registry. For more information, type `ASSOC /?` or `FTYPE /?` at the command prompt.

Problem

first time posting in StackOverflow. :D I need my software to add a couple of things in the registry. My program will use `Process.Start(@"blblabla.smc");` to launch a file, but the problem is that most likely the user will not have a program set as default application for the particular file extension. How can I add file associations to the WindowsRegistry?

Original source

Related problems