Invoking DOS command via python script


mekalai

New Member
Recruit
Apr 8, 2007
2
0
0
Hi,

I would like to know if it is possible to invoke a DOS command via a python script. If possible, what is the module which supports this?

Thanks!
 

random2

Well-Known Member
Adept
Nov 1, 2006
936
147
131
a simple google search will throw up the solution for you. Its better if you use it first before opening a thread.

module is os.
 

QwertyManiac

New Member
Disciple
Sep 23, 2005
4
0
0
30
www.harshj.com
Yes, you need to import the OS module.

Code:
 python

Python 2.5.1 (r251:54863, Oct  5 2007, 13:36:32) 

Type "help", "copyright", "credits" or "license" for more information.

>>> import os

>>> os.system("DOS COMMAND HERE")
System function returns 0 on success and garbage on fail. Outputs automatically to stdout.