Open and select file or folder with Explorer in C#

By , last updated September 13, 2019

C# Process.Start method will open Explorer and select the file or folder given.

static void openInExplorer(string path)
    string cmd = "explorer.exe";
    string arg = "/select, " + path;
    Process.Start(cmd, arg);

In this example we have explicitly specified that the process to start is explorer.exe.

Process.Start method may also be used directly like this:


Using Process.Start directly on a path may throw an exception if the process is not there.