Sign in to follow this  
Followers 0
roofninja

autoit equivalent for net start and stop

4 posts in this topic

I have done some searching through the forums and I am not sure if there are any internal commands in autoit for it, but I have to ask.

Are there any internal commands that will do a net start or net stop like you can in a bat file?


RUN . . . Slide . . . TAG . . . Your out . . . PAINTBALL !!!

Share this post


Link to post
Share on other sites



You can use the Run function for running batch commands.

e.g.

Run('net start "print spooler"')

Share this post


Link to post
Share on other sites

Are there any internal commands that will do a net start or net stop like you can in a bat file?

Maybe you want to take a look to

Share this post


Link to post
Share on other sites

Best way is to use WMI.

Here's an example:

$objWMI = ObjGet("winmgmts:\\localhost\root\cimv2")
$srvcName = "Spooler"
$services = $objWMI.ExecQuery ("Select * from Win32_Service Where Name ='" & $srvcName & "'")

For $srvc in $services
    $srvc.StartService()
Next

And here's the Microsoft Doco that tells you how to use WMI: Win32_Service Class

Enjoy.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0