title: Why is Popen("cmd.exe echo a", shell=True) not running "echo"?
body: <p>This leads to a bigger problem I am having <a href="https://stackoverflow.com/questions/44369460/unable-to-get-result-from-stdout-with-subprocess">here</a> with <code>Popen()</code>.</p>
  
  <p>The following does not do what I thought it should:</p>
  
  <pre><code>x = subprocess.Popen("cmd.exe echo a", stdout=PIPE, shell=True)
  print (x.stdout.read())
  </code></pre>
  
  <p>Returns the "title" message of the cmd console, but <code>echo a</code> is never executed.</p>
  
  <p>Same with:</p>
  
  <pre><code>x = subprocess.Popen(["cmd.exe", "echo a"], stdout=PIPE)
  print (x.stdout.read())
  </code></pre>
  
  <p>and</p>
  
  <pre><code>cmd = "cmd.exe echo a"
  x = subprocess.Popen(shlex.split(cmd), stdout=PIPE)
  print (x.stdout.read())
  </code></pre>
  
  <p>End result is in open cmd terminal that prints the standard "Microsoft Windows version..." and a CLI position of <code>C:\Python36&gt;</code>.</p>