The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.


Win32::Process::CommandLine - Perl extension for getting win32 process command line parameters


  use Win32::Process::CommandLine;
  Win32::Process::CommandLine::GetPidCommandLine($pid, $str);


In windows, there is no existing tool for finding out the process's parameters. From task manager, only process names are displayed. So starting a program with different parameters several times, it's hard to tell a process with what options.

Win32::Process::CommandLine takes process id($pid) as input, the program name and command line parameters will be returned in $str. This module supports multi-byte languages.


Win32::Process::CommandLine::GetPidCommandLine($pid, $str)

Get process's command line string


        $pid            Process ID
        $str            program name and command line parameters

Returns length of $str on success, 0 on failure.


None by default.


This is a good example for who wants to write perl extensions in C. See README in details. The C program covers concepts and usages of Unicode, WCHAR, WideCharToMultiByte, CreateFile, WriteFile, dynamic loading dll, etc...

If compiling the module with _DEBUG, it will print more information - open Makefile.PL, put _DEBUG in DEFINE.

If you don't have compiler, look for pv.exe and write some code to wrap it. pv.exe -l -i pid


Jing Kang <>