Sign in to follow this  
Followers 0
win2k

Which auto it command would be better?

4 posts in this topic

#1 ·  Posted (edited)

I just use this to start and stop windows services but i was wondering what would be better to use.

#include <_NTServices.au3>

$Stopstatus = _ServiceStop( _ToInternalServiceName("DVFaxNotifyServer") )
sleep(300)


$Startstatus = _ServiceStart( _ToInternalServiceName("DVFaxNotifyServer") )
sleep(300)

or

#include <process.au3>

$rc = _RunDos("sc stop DVFaxNotifyServer")
$rc = _RunDos("sc start DVFaxNotifyServer")

I was just wondering which snippet of code usually works better. I can add the code here for the #include files if needed.

Edited by win2k

Share this post


Link to post
Share on other sites



I would just use "RunWait(@ComSpec & " /C sc stop DVFaxNotifyServer", "", @SW_HIDE)". If your not using any other functions from those libraries it might save alot of overhead...especailly since the _RunDos UDF is just 1 line (as shown above)

Share this post


Link to post
Share on other sites

well this actually is part of a scheduled task so it runs when the user is logged out and just runs in the background, so i will have to check into that at work and test it out on our test servers.

Share this post


Link to post
Share on other sites

It is a direct copy of the _RunDos command (or rather _RunDos is a direct copy of that as mentioned in the AutoIt FAQs). if you where gona use that there should be no problem

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