CreateProcess on Python Script

Syver Enstad syver.enstad at sensewave.com
Thu Aug 10 19:28:24 EDT 2000


> I had tried that using the first paramater.  Any idea what that didnt
> work?

Don't really know, the documentation says a ton about it, so I just go for
only using the second parameter to CreateProcess as it behaves much like the
command prompt.

Here's the documentation if you really want to know :-)

>From Win32 API documentation:
for your information lpApplicationName is the first parameter and
lpCommandLine is the second.

lpApplicationName
[in] Pointer to a null-terminated string that specifies the module to
execute.
The string can specify the full path and file name of the module to execute
or it can specify a partial name. In the case of a partial name, the
function uses the current drive and current directory to complete the
specification. The function will not use the search path.

The lpApplicationName parameter can be NULL. In that case, the module name
must be the first white space-delimited token in the lpCommandLine string.
If you are using a long file name that contains a space, use quoted strings
to indicate where the file name ends and the arguments begin; otherwise, the
file name is ambiguous. For example, consider the string "c:\program
files\sub dir\program name". This string can be interpreted in a number of
ways. The system tries to interpret the possibilities in the following
order:

c:\program.exe files\sub dir\program name
c:\program files\sub.exe dir\program name
c:\program files\sub dir\program.exe name
c:\program files\sub dir\program name.exe

The specified module can be a Win32-based application. It can be some other
type of module (for example, MS-DOS or OS/2) if the appropriate subsystem is
available on the local computer.

Windows NT/2000: If the executable module is a 16-bit application,
lpApplicationName should be NULL, and the string pointed to by lpCommandLine
should specify the executable module as well as its arguments. A 16-bit
application is one that executes as a VDM or WOW process.

lpCommandLine
[in] Pointer to a null-terminated string that specifies the command line to
execute. The system adds a null character to the command line, trimming the
string if necessary, to indicate which file was actually used.
Windows NT/2000: The Unicode version of this function, CreateProcessW, will
fail if this parameter is a const string.

The lpCommandLine parameter can be NULL. In that case, the function uses the
string pointed to by lpApplicationName as the command line.

If both lpApplicationName and lpCommandLine are non-NULL, *lpApplicationName
specifies the module to execute, and *lpCommandLine specifies the command
line. The new process can use GetCommandLine to retrieve the entire command
line. C runtime processes can use the argc and argv arguments. Note that it
is a common practice to repeat the module name as the first token in the
command line.

If lpApplicationName is NULL, the first white-space - delimited token of the
command line specifies the module name. If you are using a long file name
that contains a space, use quoted strings to indicate where the file name
ends and the arguments begin (see the explanation for the lpApplicationName
parameter). If the file name does not contain an extension, .exe is
appended. If the file name ends in a period (.) with no extension, or if the
file name contains a path, .exe is not appended. If the file name does not
contain a directory path, the system searches for the executable file in the
following sequence:

  1.. The directory from which the application loaded.
  2.. The current directory for the parent process.
  3.. Windows 95/98: The Windows system directory. Use the
GetSystemDirectory function to get the path of this directory.
  Windows NT/2000: The 32-bit Windows system directory. Use the
GetSystemDirectory function to get the path of this directory. The name of
this directory is System32.

  4.. Windows NT/2000: The 16-bit Windows system directory. There is no
Win32 function that obtains the path of this directory, but it is searched.
The name of this directory is System.
  5.. The Windows directory. Use the GetWindowsDirectory function to get the
path of this directory.
  6.. The directories that are listed in the PATH environment variable.






More information about the Python-list mailing list