RE: Open the command line within a script
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

RE: Open the command line within a script

From: Tim Golden <tim.golden@viacom-outdoor.co.uk>
Date: Thu Jun 30 2005 - 16:26:51 CEST

[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
________________________________________________________________________
Received on Thu Sep 29 16:40:07 2005