AntonioGNAL Posted November 21, 2011 Share Posted November 21, 2011 Hello Everyone, I'm creating a script to install a program and i need to apply some patches after the installation is complete. However, those patches require to stop and start some services and i'm unable to do so. The part of the script to manage the services is as follows: ; Patches Start! ; Stop services to be able to copy the patch files RunWait("net stop SafeCom" & "Service", @SW_HIDE) RunWait("net stop Spooler", @SW_HIDE) ; Copy the SafeCom patches to the main directory FileCopy($d & "\scDevUtilLib.dll", "E:\SafeComG3\", 1) FileCopy($d & "\scMoneyServer.exe", "E:\SafeComG3\", 1) FileCopy($d & "\scUserImportLib.dll", "E:\SafeComG3\", 1) ; Start the services to complete the process and start working RunWait("net start Spooler", @SW_HIDE) RunWait("net start SafeCom" & "Service", @SW_HIDE) ; Finish! I know the files are trying to copy themselves, but the services are not stopping preventing the files from being overwritten. Any ideas of what i'm doing wrong? Thanks a lot. Best regards, Link to comment Share on other sites More sharing options...
water Posted November 21, 2011 Share Posted November 21, 2011 Get the return value from RunWait and see if there are any problems. $iResult = RunWait("net stop SafeCom" & "Service", @SW_HIDE) And shouldn't there be a space between "SafeCom" and "Service"? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
AntonioGNAL Posted November 21, 2011 Author Share Posted November 21, 2011 I found the problem. I can't use RunWait to stop services, but i can use it to exacute an external bat file who does. ; Patches Start! $Stop = @WorkingDir & "StopServices.bat" $Start = @WorkingDir & "StartServices.bat" ; Stop services to be able to copy the patch files RunWait($Stop) ;, @SW_HIDE) ; Copy the SafeCom patches to the main directory FileCopy(@WorkingDir & "scDevUtilLib.dll", "E:SafeComG3", 1) FileCopy(@WorkingDir & "scMoneyServer.exe", "E:SafeComG3", 1) FileCopy(@WorkingDir & "scUserImportLib.dll", "E:SafeComG3", 1) ; Start the services to complete the process and start working RunWait($Start) ;, @SW_HIDE) ; Finish! Problem Solved! Thanks. Link to comment Share on other sites More sharing options...
jazzyjeff Posted November 21, 2011 Share Posted November 21, 2011 (edited) Glad you solved it. Another way you can try it though without adding a bat file to the mix is this: RunWait(@Compsec & ' /c net stop SafeCom' & 'Service', '',@SW_HIDE) Edited November 21, 2011 by jazzyjeff Link to comment Share on other sites More sharing options...
HorseMan Posted March 29, 2012 Share Posted March 29, 2012 (edited) You can start or stop services from an AutoIT script... RunWait(@ComSpec & " /c " & 'net start YourService', "", @SW_HIDE) RunWait(@ComSpec & " /c " & 'net stop YourService', "", @SW_HIDE) Edited March 29, 2012 by HorseMan Link to comment Share on other sites More sharing options...
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