how to start explorer to console app location?

J

James Maeding

I am using VS 2005 to make a console app that shuts down explorer.exe and restarts it.
I can shut it down no problem, its starting it back up to the same folder as the console app that is proving difficult.
This code works fine in debug run but fails on final release:

Dim strAppPath As String = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly.Location()) & "\"
Process.Start("Explorer.exe", "/e, " & strAppPath)

also tried
Process.Start("Explorer.exe", Chr(34) & "/e, " & Chr(34) & " " & Chr(34) & strAppPath & Chr(34))
in case the quotes were the issue, no luck.

I can have it write the path to the console window and it shows fine, explorer seems to be rejecting it, any ideas?
 
J

JR

the next code from 2003 works fine for me

Dim strAppPath As String = Application.StartupPath

strAppPath &= IIf(strAppPath.EndsWith("\"), "\", "")

Process.Start("Explorer.exe", "/e, " & strAppPath)
 

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