title: powershell how to close a .exe process
body: <p>I want to start a .exe file from powershell and wait for it to finish and then continue to the next line in the powershell. However after the .exe file finished it's job the window remain there to be manually closed. Just like notepad. Here is what I got</p>
  
  <pre><code>start-process -FilePath notepad -Wait -NoNewWindow
  echo "it's done!"
  </code></pre>
  
  <p>I specified -NoNewWindow but it still comes with a window and the powershell have to wait until I manually close it. How can I close it automatically? The .exe file is a third party app that I have no control over.</p>
  
  <p>Please note that I want to wait for the task that the .exe file completes and then automatically close that window so that I can continue to the next line in powershell.</p>
  
  <p>I also tried -WindowStyle hidden.</p>
  
  <pre><code>start-process -FilePath notepad -Wait -WindowStyle hidden
  echo "it's done!"
  </code></pre>
  
  <p>But this is even worse I have to go to task manager to kill the hidden window without knowing it is completed or not.</p>
  
  <p>Is there a parameter better than -NoNewWindow that can force no new window show up?</p>
  
  <p>Thanks,</p>