starting externel program (win32)

Michael Robin me at
Fri Nov 2 02:46:26 CET 2001

or try win32api.ShellExecute, as in:
    win32api.ShellExecute(0, None, "cmd", "/c dir /s", "c:\\", 1)

int = ShellExecute(hwnd, op , file , params , dir , bShow )

Opens or prints a file.


hwnd : int

The handle of the parent window, or 0 for no parent. This window
receives any message boxes an application produces (for example, for
error reporting).

op : string

The operation to perform. May be "open", "print", or None, which
defaults to "open".

file : string

The name of the file to open.

params : string

The parameters to pass, if the file name contains an executable.
Should be None for a document file.

dir : string

The initial directory for the application.

bShow : int

Specifies whether the application is shown when it is opened. If the
lpszFile parameter specifies a document file, this parameter is zero.

Win32 API References


Return Value
The instance handle of the application that was run. (This handle
could also be the handle of a dynamic data exchange [DDE] server
application.) If there is an error, the method raises an exception.


"Alves, Carlos Alberto - Coelce" <calves at> wrote in message news:<mailman.1004610305.4809.python-list at>...
> I don't know the details,but I think COM objects could resolve this problem.
> Carlos Alberto
> COELCE/DPRON-Departamento de Projetos e Obras Norte
> Fone: 677- 2228
> e-mail: calves at
> \|||/
> (o o)
> --ooo0-( )-0ooo--
> -----Original Message-----
> From: stojek at [mailto:stojek at]
> Sent: Thursday, November 01, 2001 7:28 AM
> To: python-list at
> Subject: starting externel program (win32)
> Hi,
> from a script I want to start an external program (win32). This should
> be done in a way that is equivalent to typing the  name and options at
> the dos prompt. The program must not be influenced by exiting the
> script.
> Do I have to use system(), spawnv() or spawnve() or something else? 
> Any traps?
> Tanks
> Marcus

More information about the Python-list mailing list