Open windows explorer at server path

C

Colin Williams

Hi
I am trying to open windows explorer at a specific path on a server.
Path is not found
whe run. It works ok using a local path. How do i address a server?

Code as follows;
{
System.Diagnostics.ProcessStartInfo exploreTest
= new System.Diagnostics.ProcessStartInfo();
exploreTest.FileName = "explorer.exe";
exploreTest.Arguments ="\"\\servername\\path\\";
System.Diagnostics.Process.Start(exploreTest);
}
Thanks
Colin Williams
 
N

Nicholas Paldino [.NET/C# MVP]

Colin,

It's the Arguments property. It should look like this:

exploreTest.Arguments = "\\\\servername\\path\\";

Hope this helps.
 
C

Colin Williams

Thanks Nicholas
Works great. Im having trouble getting my head round the backslash
usage for paths in C#. I must have tried everthing else but your
solution.
Kind regards
Colin



Colin,

It's the Arguments property. It should look like this:

exploreTest.Arguments = "\\\\servername\\path\\";

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Colin Williams said:
Hi
I am trying to open windows explorer at a specific path on a server.
Path is not found
whe run. It works ok using a local path. How do i address a server?

Code as follows;
{
System.Diagnostics.ProcessStartInfo exploreTest
= new System.Diagnostics.ProcessStartInfo();
exploreTest.FileName = "explorer.exe";
exploreTest.Arguments ="\"\\servername\\path\\";
System.Diagnostics.Process.Start(exploreTest);
}
Thanks
Colin Williams
 
S

Samuel R. Neff

For paths you could use @"" instead of just quotes which will allow
you to use individual slashes:

exploreTest.Arguments = @"\\servername\path\";

Also for most places in windows you can use a forward-slash instead

new StreamReader("c:/temp/test.txt");

Process is one of the exceptions--won't work in the original situation
you specified, but will work most places.

HTH,

Sam


------------------------------------------------------------
We're hiring! B-Line Medical is seeking Mid/Sr. .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.
 

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