Golang Program that Deletes Itself after executing

I wrote a .wxs source that creates a msi installer. The installer extracts two file in the target location one is a zip file and the other is an unzip.exe. I will trigger the unzip.exe so that it unzips the zip file and delets the zipped folder.

<File Id="ApplicationFile2" Source="unzip.exe"  Vital="no" DiskId="1" Hidden="yes"/>
<!-- custom action for unzip and start services -->
<Binary Id="unzipExeId" SourceFile="unzip.exe"/>
<CustomAction Id="unzipAction" BinaryKey="unzipExeId" ExeCommand="" Execute='deferred' Return   ='asyncWait' Impersonate='no'/>
<InstallExecuteSequence>
    <Custom Action='unzipAction' Before='InstallFinalize'/>
</InstallExecuteSequence>  

My problem is that i must delete the unzip.exe once it is executed. Can someone give me a solution to make the unzip.exe to delete itself after executing. I wrote the unzip.exe in Golang.


Source: windows

Leave a Reply