Open the command line within a script

Tim Golden tim.golden at viacom-outdoor.co.uk
Thu Jun 30 10:26:51 EDT 2005


[Ivan Shevanski]
| Hey this is probally a noob question but here goes. . .How 
| could I open the 
| command line inside of a python script?  Would I have to use COM?

(Assuming you're on Windows from your reference to COM).
Depending on exactly what you want to do with it, you could just do:

<code>
import os

shell = os.environ['COMSPEC']

os.system (shell)
# or 
os.startfile (shell)

</code>

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________



More information about the Python-list mailing list