Click here to Skip to main content
15,867,939 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying to open a windows explorer to the path where I have my project, but I am getting file does not exist. I have the project in partition D and not in C.
The path I am using is the exact path to the folder, because I used relative paths also.
Can someone please tell me how can I open a folder on the exactpath?
Thanks.

What I have tried:

I tried to use this code:
C#
//exactpath is the full path to the folder I want to open, but there is no file, just a folder.
System.Diagnostics.Process.Start( exactpath );
Posted
Updated 16-Feb-17 4:55am

1 solution

Hi,

try this:

C#
string filePath = @"...";
System.Diagnostics.Process.Start("explorer.exe", string.Format("/select, \"{0}\"", filePath));
 
Share this answer
 
v2
Comments
Member 10850253 16-Feb-17 10:28am    
Still not working. It takes some place in my documents, and I have the project in drive D.
I am using:

string exactpath = @Path.GetFullPath(folder2);
//folder2 is a relative path
System.Diagnostics.Process.Start("explorer.exe", string.Format("/select, \"{0}\"", exactpath));
jimmson 16-Feb-17 10:31am    
Ok, are you sure the exact path is valid? Can you send the exactpath value?
Member 10850253 16-Feb-17 10:36am    
this is the directory I am using now:
D:\Works\Fernando\CRS\ASA - CRS\ASA\Años de Trabajo\2017\Archives\C#\Galeria de Imagenes\Galeria de Imagenes\bin\Debug\Fotos\prueba
I got this directly from navigating to the folder on the explorer.
jimmson 16-Feb-17 10:38am    
Ok, but it doesn't necessarily means its the value of the exactpath. Debug your code to see what actually is in the exactpath.
Member 10850253 16-Feb-17 10:45am    
I used MessageBox.show(exactpath);
and it gives me that same value.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900