how to run a DOS program without getting a box?
Raymond Hettinger
othello at javanet.com
Wed Jan 17 23:56:20 EST 2001
Dan Rolander wrote:
> If you are starting a Windows application, first get the Win32 extensions at
> http://www.activestate.com/Products/ActivePython/win32all.html. Then import
> win32api and use WinExec() like this:
>
> >>> import win32api
> >>> win32api.WinExec("notepad")
How do you call built-in DOS commands or pass arguments?
win32api.WinExec("time 23:30") doesn't do the trick :(
> If you want to launch a DOS application, and don't want a console window but
> you do want to capture stdout, you can just import os and use popen() like
> this:
>
> >>> import os
> >>> test = os.popen("c:\\test.bat")
Interesting that this works from the command prompt but fails inside the
PythonWin
environment. The error message is:
WindowsError: [Errno 2] The system cannot find the file specified
More information about the Python-list
mailing list