Here are a couple of examples of code that I have used. I use it to capture output from scritpts/exe that I run during installation of ancient legacy apps to capture output into log files.
Example 1: Here is how I output a windows command use backquote to capture SDTOUT and STDERR. @msgs = qx/$cmd 2\>\&1/; Example 2: Here is a bit of code I use to redirect STDOUT, and STDERR to a file. This is similar to what you are looking for. In my case I use it when luanching an application to ensure that I capture all stdout, and stderr data to a log file. <-- snippet open(OLDOUT, ">&STDOUT"); open(OLDERR, ">&STDERR"); # Redirect STDOUT and STDERR to the output file; these will be inherited # by the new process open(STDOUT, ">$output_file") || warn( "Unable to redirect STDOUT to $output_file\n" ); open(STDERR, ">&STDOUT") || warn( "Unable to duplicate STDOUT to STDERR\n" ); my $rc = Win32::Process::Create($H_process,$path,$cmd,$iflags,$cflags,$curdir); if ($rc == 0) { # Restore STDOUT and STDERR open(STDOUT, ">&OLDOUT"); open(STDERR, ">&OLDERR"); # For safety close(OLDOUT); close(OLDERR); printLog("Win32::Process::Create failed :: CRITICAL Failure :: cmd= $cmd\n"); $exitcode = 1; } --> end snippet -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of ?? ? Sent: Tuesday, January 16, 2007 8:16 PM To: perl-win32-users@listserv.ActiveState.com Subject: External command & STDERR Hello, perl Cookbook says that STDERR can be directed to STDOUT by 'open(STDERR, ">&STDOUT")', but external command's STDERR cann't be: open(STDERR, ">&STDOUT"); @ret = `$cmd`; is there any standard way? Regards, Hirosi Taguti _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs