Home All Groups Group Topic Archive Search About

how to start explorer to console app location?

Author
28 Dec 2006 10:34 PM
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?

Author
31 Dec 2006 10:23 AM
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)

Show quoteHide quote
"James Maeding" <jmaed***@nettaxi.com> schreef in bericht
news:kqg8p2h6gb9bnu3c8779i1h2v4v3q6hvi0@4ax.com...
>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?