Jump to content

Hot to continue that autoIT script after reboot

Recommended Posts


I have build a driver auto installation patch,

and find some drivers will force reboot after silent install,

have any method able to keeping the process for script?

Share this post

Link to post
Share on other sites

How I would do it is use an Ini file for each package for example:

1=RunWait(@ScriptDir & '\Package1\Setup.exe /s')
2=RunWait(@ScriptDir & '\Package2\Setup.exe /s')

In your Au3 Script I would add a scheduled task that will run the script on logon until it completes something like:


#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <Array.au3>
Global $hINI_PACKAGE = @ScriptDir & '\Package.ini'
Global $aINI_SECTION = IniReadSection($hINI_PACKAGE, 'Package')
    If @error Then Exit
Global $iINI_SECTION = Number(RegRead($sREG_PACKAGE, 'Package'))
    If $iINI_SECTION = '' Then $iINI_SECTION = 1

;~ Create a Scheduled Task
RunWait(@ComSpec & ' /c SchTasks /Create /SC ONLOGON /TN "' & FileGetVersion(@ScriptFullPath, 'ProductName') & '" /TR "' @ScriptFullPath & '" /ru "Domain\User /rp "Password"', '', @SW_HIDE)

For $x = $iINI_SECTION To $aINI_SECTION[0][0]
    ConsoleWrite('RegWrite("' & $sREG_PACKAGE & '", "Package", "REG_SZ", "' & $aINI_SECTION[$x][0] & '")' & @CRLF)
    ConsoleWrite('_Execute(' & $aINI_SECTION[$x][1] & ')' & @CRLF)
ConsoleWrite('RegDelete("' & $sREG_PACKAGE '")' & @CRLF)

;~ Delete the Scheduled Task
RunWait(@ComSpec & ' /c SchTasks /Delete /TN "' & FileGetVersion(@ScriptFullPath, 'ProductName') & '"', '', @SW_HIDE)

Func _Execute($hPKG_EXECUTE)
    Local $iPID_EXECUTE = Execute($hPKG_EXECUTE)
    While ProcessExists($iPID_EXECUTE)
    ;~ Check for Reboot Requirements here

Just really thinking out of the box, haven't tested but should work.

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


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.