How To Get The Outout of Win32::Process command in perl

Posted by rockyurock on Stack Overflow See other posts from Stack Overflow or by rockyurock
Published on 2010-04-03T18:26:18Z Indexed on 2010/04/03 18:33 UTC
Read the original article Hit count: 353

Filed under:
|

hello all,

i am using "use Win32::Process" for my application run as below, it runs fine but i did not get any way to get the output to a .txt file.

i used NORMAL_PRIORITY_CLASS rather than CREATE_NEW_CONSOLE to get the output on the same terminal itself but i don't know how to redirect it to a txt file.

/rocky

!/usr/bin/perl

use strict; use warnings; use Win32::Process;

Win32::Process::Create(my $ProcessObj, "iperf.exe", "iperf.exe -u -s -p 5001", 0, NORMAL_PRIORITY_CLASS, ".") || die ErrorReport(); my @command_output;

push @command_output,$ProcessObj;

open FILE, ">zz.txt" or die $!; print FILE @command_output; close FILE;

sleep 10; $ProcessObj->Kill(0);

sub ErrorReport{ print Win32::FormatMessage( Win32::GetLastError() ); }

© Stack Overflow or respective owner

Related posts about perl

Related posts about Windows