IPC::Run::Win32Process(3) User Contributed Perl Documentation IPC::Run::Win32Process(3)

IPC::Run::Win32Process -- deliver nonstandard command lines via IPC::Run.

use File::Spec ();
use IPC::Run qw(run);
use IPC::Run::Win32Process ();
use Win32 ();
$find_exe = File::Spec->catfile(Win32::GetFolderPath(Win32::CSIDL_SYSTEM),
run(IPC::Run::Win32Process->new($ENV{COMSPEC}, q{cmd.exe /c echo ""}),
    '|', IPC::Run::Win32Process->new($find_exe, q{find_exe """"""}),
    '>', \$out);

This class facilitates executing Windows programs that don't use standard command line parsing rules https://docs.microsoft.com/en-us/cpp/cpp/main-function-command-line-args#parsing-c-command-line-arguments. Notable programs having nonstandard rules include cmd.exe, cscript.exe, and Cygwin programs called from non-Cygwin programs. IPC::Run will use the two strings, verbatim, as the lpApplicationName and lpCommandLine arguments of CreateProcessA(). This furnishes unfiltered control over the child process command line.

IPC::Run::Win32Process->new( $lpApplicationName, $lpCommandLine );
IPC::Run::Win32Process->new( $ENV{COMSPEC}, q{cmd.exe /c echo ""} );


2023-10-13 perl v5.38.0