surfdork Posted December 17, 2009 Posted December 17, 2009 Hi, Yes I know this should be simple and I've scoured the forums for an answer. Does AutoIt have a command that can invoke stopping and starting a service? Ive tried the following Run('net start iexplore.exe','',@sw_hide) this failed run("cmd.exe /c sc stop iexplore.exe", "", @SW_HIDE) this failed Run(@ComSpec & " /c " & 'stop iexplore.exe', "", @SW_HIDE) this failed OK so I'm very thick headed, I'm just having a heck of a time figuring this out.
ichigo325 Posted December 17, 2009 Posted December 17, 2009 This example code is working if run as administrator, RunWait("net stop ""Windows Update""",@SystemDir) [size="2"][font="Lucida Sans Unicode"][b][/b][/font][/size]
Hyflex Posted December 17, 2009 Posted December 17, 2009 (edited) Just like to point out to you that your using SC STOP wrongly, iexplore.exe is not a service its a process Here is an example of how SC Stop is used(one I use regually at work): sc stop wuauserv This basically stops the Windows Update Service, so if your windows has updated and your getting that nasty nag screen asking you to reboot type this in and you wont need to reboot until you are ready Run("cmd.exe /c sc stop wuauserv" ,"", @SW_HIDE) That works, just your version didn't work because you were trying to close a process not trying to stop a service You should be using one of these: Your first option is: TASKKILL /IM iexplore.exe /F /IM is the image name. A process is an image so follow with the definition of the process. /F basically forces the program to close, it doesn't ask if you are sure or anything. Second Option: TASKKILL /FI "WindowTitle" Obviously the WindowTitle would be something along the lines of Internet Explorer... but this is Third Option: TSKILL iexplore /A tskill is not as good as taskkill but this one will close all instances of Internet Explorer. Forth Option: TSKILL iexplore This one will close the last used (generally) internet explorer instance, but can go wrong and close the wrong one. Last Option is: TASKKILL /PID 1234 /F If you know the PID number, you can put it inplace of 1234 (this one is useless for your script) Edited December 17, 2009 by XxXGoD
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now