Jump to content

Replace Macro

Recommended Posts

I have crated a macro that is compiled into an EXE.    When I run it, the exe needs to allow it's own file to be replaced (updated).    Is there anyway to make it so when it runs, it does not lock it's self?

I guess the other option is to copy it's self to a temp location then re-run the program from the temp location so the source file can be replaced.  Any code suggestions on this?



Link to post
Share on other sites
  • Moderators

Hi, @Unknown1, welcome to the forum. There are several ways to approach what you're trying to do, such as using FileInstall. How about posting your code so we can determine the best route?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to post
Share on other sites

Welcome to AutoIt and the forum!

The keyword to search for is: "SelfUpdate". One of the hits is this thread by Guinness.

My UDFs and Tutorials:


Active Directory (NEW 2021-06-05 - Version - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2021-06-14 - Version - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version - Download
Outlook Tools (2019-07-22 - Version - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version - Download - General Help & Support - Example Scripts
PowerPoint (2021-07-20 - Version - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version - Download - General Help & Support - Wiki

ADO - Wiki, WebDriver - Wiki


Link to post
Share on other sites

Thanks for your quick responses.  

At my work we use a program called vcp.exe, this vcp program is created by our vendor.   It verifies that all of there files are up to date and does any needed updating.  This includes updating it's self.    After this program is finished it starts another program called let's say appmenu.exe.    And from that program all other programs run.

I need vcp.exe to run as a local administrator.   And the appmenu.exe to run as the logged in user.   So to around this problem I created a two line auto script that basically performs a runaswait of vcp.exe, (with special command line options preventing vcp from starting the appmenu.exe program.    And then my script will then run appmenu.exe as the normal user.   Problem solved.

But now I have another large problem.   I have over 100 computers out there with icons all paointing to vcp.exe to start the application.  Now I need them to point to my program.  So what I did was rename my compiled script to vcp.exe and renamed the original vcp.exe to another name such run_vcp.exe.   Then my script (now vcp.exe), turns around and runs run_vcp.exe, and it will update the files.   And once finished will execute appmenu.exe.

The only hickup in this way of doing this is when run_vcp.exe updates the files, and if there is a new vcp.exe file to update.   It can't copy it because my script vcp.exe is in the way.  But because my script is not performing the copy operation there is little I can do about it.   My hope is that the run_vcp.exe can copy the vcp.exe file and overright my script.  and then operate like normal.  Then I can use other methods to place my vcp.exe file back if needed.

Sorry if that was very confusing.  But that is the best way I can explain what I'm trying to do.

The only way I can think of to fix this problem is to make make script topy the vcp.exe to a temp location, then run it's self there and terminate the origonal file.  Then the copied version will perform the runaswait of run_vcp.exe and in turn start the appmenu.exe.

Any other thoughts?


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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...