AntonioGNAL Posted November 21, 2011 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,
water Posted November 21, 2011 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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
AntonioGNAL Posted November 21, 2011 Author 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.
jazzyjeff Posted November 21, 2011 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
HorseMan Posted March 29, 2012 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
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