in reply to Want to Start / Stop windows service through executing Perl Script

This is another of those things that using the system utilities is just so much simpler:

system q[ net start "service name" ]; system q[ net stop "service name" ];

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."
  • Comment on Re: Want to Start / Stop windows service through executing Perl Script
  • Download Code

Replies are listed 'Best First'.
Re^2: Want to Start / Stop windows service through executing Perl Script
by meet_arc (Initiate) on Jun 01, 2009 at 11:45 UTC
    Thanks a lot BrowserUk for your solution. I am able to get desired output succesfully with ur comments. I would also like to enhance my this script. I would now like to go to remote level, I mean to say I would like to Start / Stop service running on other machine, by running script on my desktop machine. Can you please help me wayout?

      Did you look at the help for the net command? Did you search google? Perhaps the sc command is also of interest. Note that sc comes as standard on xp, Windows 2003 (and I believe above), it may be on one of the resource CDs for windows 2000/NT4

      Martin