Jump to content

Replace script while executing


Recommended Posts

I have a script that looks at a file share to see if a new version of the script exists. What I would like to and have not found a method is to then copy it over the one that is executing. I tried using;

FileCopy ( "\\share\updates\sample.exe", @WorkingDir, 1)

while executing sample.exe from a login script. FileCopy returns "0" indicating failure.

Any thougts would be appreciated!

Link to comment
Share on other sites

Hi,

I dunno whether that is possible, but what about copying it, save it with another name. Start it, stop the first one, delete it, rename itself.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Try this:

$newexe = "\\share\updates\sample.exe"
$myver = FileGetTime (@ScriptFullPath , 0, 1 )
$newver = FileGetTime ($newexe , 0, 1 )

if $newver > $myver Then
    FileCopy ($newexe, @WorkingDir&"\sample-new.exe", 1)
    run($newexe, @WorkingDir)
    Exit
EndIf

if @ScriptFullPath = @WorkingDir&"\sample-new.exe" Then
    FileCopy (@ScriptFullPath, @WorkingDir&"\sample.exe", 1)
    run(@WorkingDir&"\sample.exe",@WorkingDir)
    Exit
EndIf

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...