On 2006-04-19, Jeff Groves <[EMAIL PROTECTED]> wrote: > I'm writing a launcher that should do the following: > > 1. Activate a .bat file to set environmental variables. > 2. Start 3 programs, using said environmental variables as arguments. > > However, I can't get the environmental variables to stick because all > of Pythons' system start/open functions split off into their own little > subshells, therefore the .bat file doesn't affect the main shell. > > How can I use the .bat file to set environmental vars from Python?
You can try launching a single shell with subprocess.Popen, and run everything inside that: from subprocess import * p = Popen("cmd", stdin = PIPE, stdout = PIPE) output, err = p.communicate(""" vars.bat prog1.exe prog2.exe prog3.exe """) print output I can't test this because I don't have a Windows system. Otherwise, as others have suggested, replace vars.bat with modifications to os.environ. -- http://mail.python.org/mailman/listinfo/python-list