title: Using subprocess.call() to pass commands to execute by cmd
body: <p>I am trying to set my IP address to a specific one on a LAN Network.</p>
  
  <p>To do this i have tried using the following:</p>
  
  <pre><code>import subprocess
  command='netsh interface ipv4 set address name="Local Area Connection* 4" source=static address=192.168.173.234 mask=255.255.255.0 gateway=192.168.0.1'
  subprocess.call(["cmd.exe", command])
  </code></pre>
  
  <p>The only thing this results in is the starting up of an empty cmd.exe that isn't doing anything.</p>
  
  <p>Also, what for would the shell=True be used ?
  When I try to use it, python returns a SyntaxError</p>
  
  <p>UPDATE: If I use:  </p>
  
  <pre><code>command='netsh interface ipv4 set address name="Local Area Connection* 4" source=static address=192.168.173.222 mask=255.255.255.0 gateway=192.168.0.1'
  subprocess.check_call(["netsh.exe", command])
  </code></pre>
  
  <p>Python Returns the error:  </p>
  
  <pre><code>Traceback (most recent call last):
    File "D:file path", line 8, in &lt;module&gt;
      subprocess.check_call(["netsh.exe", netsh_cmd])
    File "C:\Python27\lib\subprocess.py", line 540, in check_call
      raise CalledProcessError(retcode, cmd)
  CalledProcessError: Command '['netsh.exe', 'netsh interface ipv4 set address name="Local Area Connection* 4" source=static address=192.168.173.222 mask=255.255.255.0 gateway=192.168.0.1']' returned non-zero exit status 1
  </code></pre>