Although @nos's answer works well, mostly (sometimes, in a not deterministically way it creates another explorer windows even though it may already exists), I became unsatisfied with the time spent by the Process.Start(proc) to open an existing window, sometimes 2 to 4 seconds.
So, adapting some VB.NET code I achieve a very fast way of reusing a existing explorer window that is pointing to a desired folder:
First, add COM references:
using Shell32;//Shell32.dll for ShellFolderView
using SHDocVw;//Microsoft Internet Controls for IShellWindows
[DllImport("user32.dll")] public static extern int ShowWindow(IntPtr Hwnd, int iCmdShow); [DllImport("user32.dll")] public static extern bool IsIconic(IntPtr Hwnd); public static bool ShowInExplorer(string folderName) { var SW_RESTORE = 9; var exShell = (IShellDispatch2)Activator.CreateInstance( Type.GetTypeFromProgID("Shell.Application")); foreach (ShellBrowserWindow w in (IShellWindows) exShell.Windows()) { if (w.Document is ShellFolderView) { var expPath = w.Document.FocusedItem.Path; if (!Directory.Exists(Path.GetDirectoryName(expPath)) || Path.GetDirectoryName(expPath) != folderName) continue; if (IsIconic(new IntPtr(w.HWND))) { w.Visible = false; w.Visible = true; ShowWindow(new IntPtr(w.HWND),SW_RESTORE); break; } else { w.Visible = false; w.Visible = true; break; } } } }
Although we are interested in ShellFolderView objects, and foreach (ShellBrowserWindow w in (ShellFolderView) exShell.Windows()) was more logical, unfortunately ShellFolderView does not implement IEnumerable, so, no foreach :(
Anyway, these is a very fast (200 ms) way of select and blink the correct already opened explorer window.