Reputation: 34158
I want to open application directory with button click. i get such error
Does anyone have an idea?
Upvotes: 3
Views: 5755
Reputation: 141638
If you set UseShellExecute
to true
, then you can use Process
to open a directory. For example, this will open the C:\
drive. You can specify any path you want.
Process process = new Process();
process.StartInfo.UseShellExecute = true;
process.StartInfo.FileName = @"C:\";
process.Start();
This is similar to using the Run dialog from the start menu. For instance, even though a Word document is not a program, using Shell Execute will allow you to "Start" a word document by using whatever program is associated with it. Likewise the same with a directory.
Upvotes: 5
Reputation: 7468
Have you tried "explorer.exe {0}" ? Explorer is the process you want, and the argument your intended path.
Upvotes: 1