Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Launch the default Application for a File (Or Web Browser for Web Page)

How-to

Launch the default Application for a File (Or Web Browser for Web Page)

by  ThatRickGuy  Posted    (Edited  )
It appears that this no longer works correctly in XP with SP2, if I find a way to make it work again I'll update the FAQ

Nice and simple, but very handy, expecially now that FireFox is out and more and more people are moving away from IE. This will open the default web browser:

Code:
System.Diagnostics.Process.Start("cmd /c ""start http://www.google.com""")

This is also great for standard windows files. Like Adobe Acrobat Reader and PDF files:

Code:
System.Diagnostics.Process.Start("cmd /c ""start " & FilePathAndName & """)

the Joy of the Start command is that it lets windows resolve the correct application to open the file with.
-Rick
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top