I run it on Windows 2000.

Then you could use the Win32::Job module, standard with ActivePerl 5.8. For example:

use strict; use Win32::Job; my @cmds = ( [ "netstat", 'netstat -na' ], [ $^X, 'perl -le "print\"pid=$$:Sleep 5 secs.\";sleep 5"' ], ); my $job = Win32::Job->new(); my @pids; my $i = 0; for my $cmd (@cmds) { ++$i; my $pid = $job->spawn($cmd->[0], $cmd->[1], { stdin => 'NUL', stdout => "$i.out", stderr => "$i.err" } ) or die "spawn: $^E"; push(@pids, $pid); } print "Processes pids: @pids are running...\n"; $job->run(60); # allow up to 60 seconds for all processes to end print "Job complete (output in files 1.out/1.err/2.out/2.err).\n"; my $stat = $job->status(); for my $pid (@pids) { exists($stat->{$pid}) or die "oops, no status for $pid"; my $rc = $stat->{$pid}->{exitcode}; my $t = $stat->{$pid}->{time}; print "pid=$pid, rc=$rc, elapsed time=$t->{elapsed} secs\n"; }

Update: Sorry, on re-reading your question, I don't think Win32::Jobs will help you. I suggest you simply launch the processes using Win32::Process (also standard with ActivePerl) and exit.

use strict; use Win32::Process; my $SysDir = "$ENV{SystemRoot}\\system32"; my @cmds = ( [ "$SysDir\\netstat.exe", 'netstat -na' ], [ $^X, 'perl -le "print\"pid=$$:Sleep 5 secs.\";sleep 5"' ], ); for my $cmd (@cmds) { Win32::Process::Create(my $hProc, # process object $cmd->[0], # executable $cmd->[1], # command line 1, # inherit handles NORMAL_PRIORITY_CLASS, # priority '.') # working dir or die "error create process: $^E\n"; my $pid = $hProc->GetProcessID(); print "Process pid $pid launched.\n"; } print "I'm outta here.\n";

In reply to Re: Re: Re: launch and then exit out of app by eyepopslikeamosquito
in thread launch and then exit out of app by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.