python call external program

Ben Thomas bthomas at trey-industries.com
Tue Sep 14 11:20:05 EDT 1999


OK, I can use: "os.system('dir c:\*.* >myfile.txt')"

But how can I call 'mybatch.BAT' from python? A DOS batch file that is.

closer... ever closer...
Ben



Ben Thomas wrote:

> very simple question:
>
> What would I do to have Python execute something from the DOS command
> line. I am very new to python but I bet it is in a moudule but don't
> know the command or the modules to look in. I want to
>
> dir >%myvar.txt
>
> #this code would run dir from the command line and pass the var "myvar"
> , dir would dump a listing of the files into a text file called xxxx.txt
>
> pointers?
>
> Ben





More information about the Python-list mailing list