Ultimate newbie question? How to execute DOS commands via Python.
Gerrit Holl
gerrit.holl at pobox.com
Mon Nov 1 14:16:36 EST 1999
Gabe Newcomb wrote:
> Hi all:
> My job here at work would be so much easier if I could use Python
> to run a series of DOS commands (I'd rather do this than write a batch file
> for a number of reasons). Any pointers/examples on this would extremely
> helpful!
It's in the documentation:
os module:
system (command)
Execute the command (a string) in a subshell. This is implemented by
calling the Standard C function system(), and has the same limitations.
Changes to posix.environ, sys.stdin etc. are not reflected in the
environment of the executed command. The return value is the exit status
of the process encoded in the format specified for wait().
I don't know how to get the output on DOS systems: os.pipe() and sisters are
not available on your platform, but this may be well enough.
regards,
Gerrit.
--
linuxgames.nl.linux.org All about games on Linux in Dutch (under construction).
www.nl.linux.org The Dutch resource for Dutch Linux documentation.
www.nl.linux.org/discoverb Learn foreign words and definitions.
www.nl.linux.org/~gerrit/asperger I'm an Asperger, go here for more info.
www.nl.linux.org/~gerrit About me and pictures of me.
More information about the Python-list
mailing list