Executing DOS command with result
Peter Hansen
peter at engcorp.com
Sat Dec 28 23:13:53 EST 2002
C42 wrote:
>
> I'm trying to write a Python script to automate an MS Exchange defragment
> procedure.
>
> Part of the procedure uses a Microsoft-created DOS utility that, when run,
> returns a message in the DOS box that reports how it ran.
>
> What I'm trying to determine is if there is any way to have Python use
> conditional statements based upon the result of running this program.
Check out os.popen(), or the popen2 module in the standard library.
Used with some simple text-matching, or regular expressions, one can
definitely do what you ask.
-Peter
More information about the Python-list
mailing list