Opening a folder in explorer and selecting a file
Solution 1:
// suppose that we have a test.txt at E:\
string filePath = @"E:\test.txt";
if (!File.Exists(filePath))
{
return;
}
// combine the arguments together
// it doesn't matter if there is a space after ','
string argument = "/select, \"" + filePath +"\"";
System.Diagnostics.Process.Start("explorer.exe", argument);
Solution 2:
Use this method:
Process.Start(String, String)
First argument is an application (explorer.exe), second method argument are arguments of the application you run.
For example:
in CMD:
explorer.exe -p
in C#:
Process.Start("explorer.exe", "-p")