in reply to kill a process with process name
gash1.pl:use warnings; use strict; use Win32::Process; my $ProcessObj; Win32::Process::Create ( $ProcessObj, # Process handle "C:\\Perl\\bin\\perl.exe", "C:\\Perl\\bin\\perl.exe gash1.pl", 0, # inherit handles boolean NORMAL_PRIORITY_CLASS, # Creation flags "."); my $pid = $ProcessObj->GetProcessID(); my $exitcode = 37; print "Hit <RETURN> to continue...."; <STDIN>; Win32::Process::KillProcess($pid, $exitcode);
I had a similar requirement a while ago, Proc::Background does a similar thing, but I also had to use standard modules. I have put my code on my scratchpad - feel free to use any bits you like.use warnings; use strict; while (1) { print "$0 in a loop....\n"; sleep 1; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: kill a process with process name
by Anonymous Monk on Apr 14, 2010 at 09:00 UTC |