Thanks very much for your help and information. With this info I could solve my issues rapidly. I rebuild the example of Peter Dragon for my usage:
sub start_child { my $Cmd = $_[0]; my $CmdOptions = $_[1]; my $ChildProc; my $ChildPid; die "cannot execute cmd: $Cmd" unless (-x "$Cmd"); require Win32::Process; Win32::Process::Create($ChildProc, $Cmd, $CmdOptions, 0, 0, ".") || +confess "Could not spawn child: $!"; $ChildPid = $ChildProc->GetProcessID(); # catch early child exit, e.g. if program path is incorrect sleep(1.0); POSIX::waitpid(-1, POSIX::WNOHANG()); # clean up any defunct child p +rocess if (kill(0,$ChildPid)) { print "Started child process id $ChildPid\n"; } else { warn "Child process exited quickly: $Cmd: process $ChildPid"; } return $ChildPid; } $ChildPid = start_child($Cmd1, $Cmd1Options); sleep(5.0); $ChildPid = start_child($Cmd2, $Cmd2Options);
At the moment I stop the childs by TASKKILL /F /PID of the commands I've started. Not the nicest solution, better to do it with interrupts, but I haven't read that part of the Perl cookbook yet ;)

In reply to Re^7: Perl Background processes in Windows by gepebril69
in thread Perl Background processes in Windows by spx2

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.