title: How to supress Powershell window when using the -File option
body: <p>I'm calling Powershell like so:</p>
  <pre><code>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noprofile -noninteractive -nologo -file &quot;C:\Users\dummy\Documents\dev\powershell\samples\test.ps1&quot;
  </code></pre>
  <p>I'm calling it from a python script, but the same problem can be observed if called via a shortcut. I thought the <code>-NonInteractive</code> flag would cause Poweshell to execute in a hidden window, but it doesn't. Is there a way of supressing the console window when calling Powershell from an external application?</p>
  <h1>Solution based on Johannes Rössel suggestion</h1>
  <pre><code>import subprocess
  st_inf = subprocess.STARTUPINFO()
  st_inf.dwFlags = st_inf.dwFlags | subprocess.STARTF_USESHOWWINDOW
  subprocess.Popen([&quot;notepad&quot;], startupinfo=st_inf)
  </code></pre>