use strict; use warnings; use Win32; use Win32::Process; $| = 1; my ($process, $exitcode, $pid); print "Starte ping ..\n"; Win32::Process::Create( $process, "C:\\windows\\system32\\ping.exe", "ping -n 5 127.0.0.1", 0, NORMAL_PRIORITY_CLASS, '.', ) or die Win32::FormatMessage( Win32::GetLastError() ); print "Warte max 10 Sekunden auf ping\n"; for (1 .. 10) { print; $pid = $process->GetProcessID(); $process->GetExitCode($exitcode); print " EC-Schleife = $exitcode,\tPID = $pid\n"; sleep 1; $exitcode = undef; $pid = undef; } $process->Kill(99) or die "Kann Prozess nicht killen '$process'"; $process->GetExitCode($exitcode); print " Exitcode Ende = $exitcode\n";