I have created a simple program in C#, that saves data into a file with custom extension. The file can be saved anywhere in the user's PC, and the user can load different data file every time.
I have built the program into an exe file, and I deploy it using 3rd party installer. The installer basically packs the exe file and it's dependencies into one installation exe file that the user can run
When the user run the installation file, a basic installation starts: accept license, select installation path…
And the program and it's dependencies are unpacked to the selected installation path.
Now I want to associate the custom file extension that I use for my program to always open in my program.
The simplest solution I found for that was using a bat file that runs after my program is installed (this is handled by the 3rd party installer, I just add the bat file as a dependency).
The bat file basically just run the Assoc and Ftype commands like that:
Assoc .MyExtension=MyProgram
Ftype MyProgram="Absolute Path" "%%1"
But I have 2 problems with that:
1) This commands require administrative permission, which is a problem for my clients to get.
2) The Ftype command needs a full path to the installation path, but all I have is the relative path (which is next to the bat file), because the installation path is determined by the user when he installs it.
;tldr;
My questions are:
1) Can I accomplish that without administration permission?
2) How to use the Ftype with relative path.