programming-examples/perl/Win32/Starting services.pl

22 lines
405 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
$status = Win32::Service::StartService($host, $service);
#!/usr/bin/perl -w
use Win32::Service;
$num_args = scalar( @ARGV );
$host = '';
$service = "yourServiceName";
$status = Win32::Service::StartService($host, $service);
if ($status) {
print "Started $service.\n";
} else {
print_error();
}
sub print_error {
print Win32::FormatMessage( Win32::GetLastError() );
}