Batch commands on Windows

Josiah Carlson jcarlson at nospam.uci.edu
Fri Jan 23 03:48:28 EST 2004


> So, after reading some messages about os.system, and looking at the popen
> stuff and trying it a bit, I still have not found a way to keep a command
> window open for several commands (on Windows 2000/XP), while seeing the
> normal output in a command window.  All I want to do is do what a batch file
> does, but I want to actually have functions and associative arrays and all
> the other niceties of python.

Q: "How do I get python to run these other things, and keep the window 
open so that I can see their output?"

A: Making sure to run your script with the console version of Python 
(python.exe, NOT pythonw.exe):

#insert the body of your script here

raw_input("press enter to continue...");
# or even
#os.system('pause');


Q: "I'm running the non-console version of Python, how do I capture the 
output of my scripts so that I can do something with it afterwards?"

A: I'll answer this one tomorrow, it is getting late.

  - Josiah



More information about the Python-list mailing list