Calling a dos batch file from python

n o s p a m p l e a s e nospam.please at alum.com
Wed Sep 5 03:30:18 EDT 2007


On Sep 4, 5:01 pm, kyoso... at gmail.com wrote:
> On Sep 4, 8:42 am, n o s p a m p l e a s e <nospam.ple... at alum.com>
> wrote:
>
> > Suppose I have a batch file called mybatch.bat  and I want to run it
> > from a python script. How can I call this batch file in python script?
>
> > Thanx/NSP
>
> The subprocess module should work.
>
Thanx to all those who responded. It was quite simple.

import os
os.system("mybatch.bat")

NSP




More information about the Python-list mailing list