Announcement

Collapse
No announcement yet.

Executing / Deleting EXE file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • BobH
    replied
    Hey thanks Ulrich. I like the idea of running the file in LuaScript. I will do it that way now. Thanks.

    Leave a comment:


  • Ulrich
    replied
    Where are you deploying the file, under ProgramFilesFolder or somewhere else where elevation is required to delete the file? In this case, you cannot use an Immediate LuaScript action, because it works with impersonation - running in user context, not as admin. For this to work, you will need the LuaScript in deferred mode, which allows you to run the script with elevation.

    https://www.indigorose.com/webhelp/m..._Installer.htm

    In this situation, I would do both actions in LuaScript: Time it as "Before InstallFinalize", then run the app with File.Run(), wait for it to finish, then delete the file. Make sure that you set a condition to run the script only if the product is not installed, so MSI will not attempt to perform the action in repair mode or during uninstall.

    This sounds like a case where a bootstrapper could be used. You could add the file to the bootstrapper's resources, so it is not part of the MSI. You could also run and delete the file, once the MSI was processed.

    Ulrich

    Leave a comment:


  • BobH
    started a topic Executing / Deleting EXE file

    Executing / Deleting EXE file

    I need to have a .exe file execute after all of the files in the msi have been installed, and then I need to delete that .exe file after it has finished executing. How would I do that?

    I have tried using a "Run Executable" custom action for the .exe file (ID = ExecuteFile) that is scheduled as "Deferred - Commit" and "Async wait", with the timing as "After- PublishComponents".

    Then I created a Run LuaScript" custom action (ID = DeleteFile) that simply deletes the file in the luascript, which is scheduled as "Immediate" and "Check", with the timing as "After - ExecuteFile".

    But the DeleteFile action always happens long before the ExecuteFile action. I would have thought that with the ExecuteFile action set as "Async wait" that the DeleteFile action would not happen until the ExecuteFile thread was completed.
Working...
X