Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I open Windows Explorer to a certain directory from within a WPF app?

In a WPF application, when a user clicks on a button I want to open the Windows explorer to a certain directory, how do I do that?

I would expect something like this:

Windows.OpenExplorer("c:\test"); 
like image 982
Edward Tanguay Avatar asked Nov 17 '09 01:11

Edward Tanguay


People also ask

How do I open a File Explorer in WPF?

Create a WPF project using Visual Studio and add a TextBox, a Button, and a TextBlock control to page. The final Window looks like Figure 2. Figure 2. When you click the Browse button, we will browse text files and set the selected file name as the text of the TextBox.

How do I get Windows Explorer to open in a certain folder?

With File Explorer open, tap or click the File option at the top of the window and choose Change folder and search options. Once the Folder Options window opens, tap or click the dropdown box for Open File Explorer to and make your choice. Hit OK to save it.

How do I open a directory in C#?

To open a folder, you just specify folder name without /select, part. Something like explorer c:\folder_name . /select option requires an existing file or folder and open its parent and select the item. Thus both options are available.

What are the different ways to open Windows Explorer?

To open File Explorer, click on the File Explorer icon located in the taskbar. Alternatively, you can open File Explorer by clicking on the Start button and then clicking on File Explorer.


1 Answers

Why not Process.Start(@"c:\test");?

like image 86
Jamie Penney Avatar answered Nov 03 '22 19:11

Jamie Penney