Filename from Open With

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?
 
J

Jim Wooley

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
 
C

Cyril Gupta

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.
 
G

Guest

You are right. The full path and file name are passed as the first and only
arg. Thanks very much!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top