469,963 Members | 2,084 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,963 developers. It's quick & easy.

Filename from Open With

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?
Aug 14 '06 #1
3 991
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
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?

Aug 14 '06 #2
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.
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?

Aug 14 '06 #3
You are right. The full path and file name are passed as the first and only
arg. Thanks very much!

"Jim Wooley" wrote:
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
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?


Aug 14 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Kornelius Finkenbein | last post: by
2 posts views Thread by Nemesis | last post: by
1 post views Thread by Sameh Abdelatef | last post: by
5 posts views Thread by cpp | last post: by
10 posts views Thread by sam | last post: by
3 posts views Thread by zweng | last post: by
7 posts views Thread by pedagani | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.