title: code to open windows explorer (or focus if exists) with file selected
body: <p>My goal is to write a C# code that will open a Windows Explorer window, with a particular file selected. If such window is already open, I want to bring it to front. I have tried two options.</p>
  
  <p>First, I start by explicitly calling <code>explorer.exe</code>:</p>
  
  <pre><code>arg = "/select, " + pathToFile;
  Process.Start("explorer.exe", arg);
  </code></pre>
  
  <p>This opens and selects a window fine, but the problem is that it will always open a new window, even if one exists. So I tried this:</p>
  
  <pre><code>Process.Start(pathToDir);
  </code></pre>
  
  <p>This either opens a new window or focuses an old one, but gives me no option to select a file.</p>
  
  <p>What can I do? I looked at <a href="http://www.geoffchappell.com/studies/windows/shell/explorer/cmdline.htm"><code>explorer</code>'s arguments</a> and I don't see anything I can use. A last-resort option I can come up with is to get the list of already open windows and use some WINAPI-level code to handle it, but that seems like an overkill.</p>