running batch scripts
Trent Mick
trentm at ActiveState.com
Tue Nov 12 17:25:51 EST 2002
[tagarwal wrote]
> Hi
> anyone can help me to write a python script to invoke a windows batch script
> (.bat file)
> and then keeping the cmd (cmd.exe or the dos window)window alive so as to
> use the same window to run some other commands.
> I tried using popen2, but how do i tell the cmd.exe to execute the command
> once i place the command on stdin.
You need to launch your batch file with "cmd.exe /k". From cmd.exe's
help:
C:\> cmd /?
...
/K Carries out the command specified by string but remains
...
so try this Python code:
os.system("cmd.exe /k your_batch_file.bat")
Cheers,
Trent
--
Trent Mick
TrentM at ActiveState.com
More information about the Python-list
mailing list