When you use "open with" the path to the file is handed to you as a program argument - so if you are writing a Console app then you would get it via the
args
parameter to the
Main
method.
For a winforms app it is easiest to get them via the Environment:
string[] args = Environment.GetCommandLineArgs();