Jump to content
Sign in to follow this  

updater which allows ability to update updater itself?

Recommended Posts


i have a script that detects if theres a newer version (checks on a lan share)

(taken from script that gets updated)

Func Auto_UpdateCheck()
    If Not FileExists("\\serverpath") Then
        MsgBox(262144, "Check for Updates", "\\serverpath is not accessible.")

    $search = FileFindFirstFile("\\serverpath\scriptname*.exe")

    If $search = -1 Then
        MsgBox(262144, "Check for Updates", "Script cannot be found in \\serverpath.")

    While 1
        $file = FileFindNextFile($search)
        If @error Then ExitLoop
        $recent_ver = StringTrimRight($file, 4)

    If $ver < $recent_ver Then

Func Get_Update()

    If FileExists(@ScriptDir & "\_updater.exe") Then
        FileMove(@ScriptDir & "\_updater.exe", @ScriptDir & "\updater.exe", 1)

    If FileExists(@ScriptDir & "\updater.exe") Then
        Run(@ScriptDir & "\updater.exe")
        MsgBox(262144, "Script", "UPDATER.EXE was not found in " & @ScriptDir & @CRLF & _
                "Please manually extract/replace your folder with server copy.")
        _IECreate("file://serverpath", 0, 1, 0)

EndFunc   ;==>Get_Update

the file on the server is a self extracting executable that has the new version of the script along with updater.exe (current updater) and _updater.exe (new updater.exe)

_updater.exe gets renamed to updater.exe (so far the only way i can think of on how to update the updater)

problem is.. new updater doesn’t run till the next update. because updater is in use, when its trying to replace it!

can anyone think of a more clever way to allow for not only the updating but also the replacement of the updater itself?

Edited by gcue

Share this post

Link to post
Share on other sites

When you detect _updater being present, couldn't you launch another script (that simply handles the file replacement) that will wait until the main is no longer loaded?

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  


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.