Win32::Process
This module provides access to extended Win32 process creation and management abilities.
Process objects are created with the Create
method (the constructor). Additional
methods can be used on objects to kill, suspend, resume, and set the priorities of processes.
The Create
constructor has the following syntax:
Win32::Process->Create($Proc, app, cmnd, hndls, opts, dir)
The arguments to Create
are as follows:
-
$Proc
Name of the reference for the created process object.
-
app
Full pathname of the executable.
-
cmnd
Command line for executable.
-
hndls
Determines handle inheritance. A value of 1 turns on inheritance; a 0 value turns it off.
-
opts
Sets options to implement when the process is created. The available options for this argument are listed below.
-
dir
The working directory for the executable.
The process is created by passing the command line in cmnd
to the executable
named in app
. For example, a process object for a text file running in Notepad
is created like this:
use Win32::Process; Win32::Process->Create($proc, 'C:\\windows\\Notepad.exe', "Notepad perlnut.txt", 1, DETACHED_PROCESS, ".");
The process creation options given by the opts
argument to Create
are:
CREATE_DEFAULT_ERROR_MODE Give the process the default error mode. CREATE_NEW_CONSOLE Create a new console for the process. Can't be used with DETACHED_PROCESS. CREATE_NEW_PROCESS_GROUP Create process as root of a new process group. CREATE_SEPARATE_WOW_VDM Run process in its own Virtual DOS Machine (VDM).
Get Perl in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.