Filename from Open With

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm building a small app that is launched by right-clicking on an XML file
and choosing "Open With...". Ugly, I know, but I can't associate .xml with
my app. Anyway, once the app is launched, how can I get the full path to the
XML file that was opened?
 
I believe using Open With passes as a parameter to the opening application
the full path and filename of the document to be opened. Once you grab the
file parameter as a switch from My.Application.CommandLineArgs. Once you
have the string, use System.IO.Path.GetFullPath to retrieve only the path
portion.

Jim Wooley
http://devauthority.com/blogs/jwooley/default.aspx
 
Hello smay,

What Open with... does is... Pass the file name you have clicked as a commandline
argument to your application. So what you should be looking for is how to
read the commandline arguments from your application.

I think in .Net + VB, this can be done pretty easily.

System.Environment.GetCommandLineArgs()

I think that should do the trick... but I am writing from memory, and I could
be wrong. Let me know if you get anywhere

Regards
Cyril Gupta

You can do anything with a little bit of 'magination.
 
You are right. The full path and file name are passed as the first and only
arg. Thanks very much!
 
Back
Top