in reply to Re: (2) Stop/start Windows services with perl
in thread Stop/start Windows services with perl
Hmmm... well in that case, I would use something like:
@rc = `net stop messenger`; if ($rc[1] =~ /success/) { print "Messenger stopped successfully\n"; } else { print "Problem occurred stopping Messenger\n"; } @rc = `net start messenger`; if ($rc[1] =~ /success/) { print "Messenger started successfully\n"; } else { print "Problem occurred starting Messenger\n"; }
You might also want to run `net start` on its own first and search for the name of the service you're about to start or stop -- that way you'll know whether it's running.
Gordon
|
|---|