Michael L Michael L - 1 year ago 97
C# Question

Open Folder and Select the file

the following code produces a file not found exception.

"explorer.exe /select,"
+ listView1.SelectedItems[0].SubItems[1].Text + "\\"
+ listView1.SelectedItems[0].Text);

how can I get this command to execute in c#?

Answer Source

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")