title: Cannot find the file specified when using subprocess.call('dir', shell=True) in Python
body: <p>In a 64-bit system with 32 bit python 2.7 installed I am trying to do the following:</p>
  
  <pre><code>import subprocess
  p = subprocess.call('dir', shell=True)
  print p
  </code></pre>
  
  <p>But this gives me:</p>
  
  <pre><code>Traceback (most recent call last):
    File "test.py", line 2, in &lt;module&gt;
      p = subprocess.call('dir', shell=True)
    File "C:\Python27\lib\subprocess.py", line 522, in call
      return Popen(*popenargs, **kwargs).wait()
    File "C:\Python27\lib\subprocess.py", line 709, in __init__
      errread, errwrite)
    File "C:\Python27\lib\subprocess.py", line 957, in _execute_child
      startupinfo)
    WindowsError: [Error 2] The system cannot find the file specified
  </code></pre>
  
  <p>If I in the terminal do...</p>
  
  <pre><code>dir
  </code></pre>
  
  <p>...it of course prints the present folder content.</p>
  
  <p>I have tried to change the shell parameter to shell=False.</p>
  
  <p>Edit: Actually I cannot call any executable  on the path with <code>subprocess.call()</code>. The statement <code>p = subprocess.call('dir', shell=True)</code> works fine on another machine and I think that it is related.</p>
  
  <p>If I do</p>
  
  <pre><code> subprocess.call('PATH', shell=True)
  </code></pre>
  
  <p>then I get</p>
  
  <pre><code>Traceback (most recent call last):
    File "test.py", line 4, in &lt;module&gt;
      subprocess.call('PATH', shell=True)
    File "C:\Python27\lib\subprocess.py", line 522, in call
       return Popen(*popenargs, **kwargs).wait()
    File "C:\Python27\lib\subprocess.py", line 709, in __init__
      errread, errwrite)
    File "C:\Python27\lib\subprocess.py", line 957, in _execute_child
      startupinfo)
  WindowsError: [Error 2] The system cannot find the file specified
  </code></pre>
  
  <p>If I do:</p>
  
  <pre><code>import os
  print os.curdir
  </code></pre>
  
  <p>then I get</p>
  
  <pre><code>.
  </code></pre>
  
  <p>All of the above is executed in the terminal started in Administrator mode.</p>