Check out the Pastebin Gadgets Shop. We have thousands of fun, geeky & affordable gadgets on sale :-)Want more features on Pastebin? Sign Up, it's FREE!

Running shell command on Windows from Python

By: a guest on Apr 16th, 2012  |  syntax: Python  |  size: 0.13 KB  |  views: 260  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print  |  QR code  |  clone
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. pythoncom.CoInitialize()
  2. shell = win32com.client.Dispatch('WScript.Shell')
  3. shell.Run(command, 1, False)
  4. pythoncom.CoUninitialize()
clone this paste RAW Paste Data