os.system always opens new window on Windows XP/2000

Kent Hsu (Hsu, Chih-Peng) cphsu at zen.com.tw
Wed Jan 7 09:33:17 CET 2004


John <ohgoddearlord at yahoo.com> wrote in message
news:d0132d7d.0401061045.73c28639 at posting.google.com...
> Can anyone tell me how to run a bunch of commands in the same command
> line window?  When I do this:
>
> system("command1")
> system("command2")
> ...

If you just want to hide the console window, try
"win32process.CreateProcess"
If you want to set environment variables, I think batch file is OK.

Best  Regards,
Kent Hsu

>
> it opens a new window for every system call.  The alternative I can
> think of is to write out the command to a batch file and run that, but
> I'm wondering if there is a better way to do it.
>
> Partly it is annoying to have 20 cmd windows flash on the screen, but
> also I don't think it works if I do something like this:
>
> system("set envvar=hi")
>
> since I think the envvar does not persist once the command window is
> closed.
>
> thanks!





More information about the Python-list mailing list