Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows 执行后删除自身的Go程序_Windows_File_Go - Fatal编程技术网

Windows 执行后删除自身的Go程序

Windows 执行后删除自身的Go程序,windows,file,go,Windows,File,Go,我编写了一个.wxs源代码来创建msi安装程序。安装程序在目标位置提取两个文件,一个是zip文件,另一个是unzip.exe。我将触发unzip.exe,以便它解压缩zip文件并删除压缩文件夹 <File Id="ApplicationFile2" Source="unzip.exe" Vital="no" DiskId="1" Hidden="yes"/> <!-- custom action for unzip and start services --> <

我编写了一个.wxs源代码来创建msi安装程序。安装程序在目标位置提取两个文件,一个是zip文件,另一个是unzip.exe。我将触发unzip.exe,以便它解压缩zip文件并删除压缩文件夹

<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>  


我的问题是,一旦执行unzip.exe,我就必须将其删除。有人能给我一个解决方案,让unzip.exe在执行后删除自己吗。我在Go中编写了unzip.exe。

您可以在%TEMP%中解压,并将解压后的文件移动到目标。但实际上,只需使用IExpress,它就可以实现您想要的功能,并可以压缩内容。