inno-setup – InnoSetup – 安装前复制文件
发布时间:2020-12-15 04:08:09 所属栏目:大数据 来源:网络整理
导读:如何在安装前复制,移动,重命名用户文件? 我们可以使用[InstallDelete]部分轻松删除文件: [InstallDelete]Type: files; Name: "{app}SomeFile.exe"; 我们可以用类似的方式复制,重命名吗? 编辑: 我尝试在[Files]部分中进行此操作但在编译期间收到错误,因
如何在安装前复制,移动,重命名用户文件?
我们可以使用[InstallDelete]部分轻松删除文件: [InstallDelete] Type: files; Name: "{app}SomeFile.exe"; 我们可以用类似的方式复制,重命名吗? 编辑: 我尝试在[Files]部分中进行此操作但在编译期间收到错误,因为源文件不存在: [Files] Source: "{app}SomeFile.exe"; DestDir: "{app}SomeDirSomeFile.exe"; 解决方法
对于复制文件,您可以使用[Files]部分,但我认为没有办法在单独的部分中移动或重命名操作,因此我建议您使用[Code]部分.
以下是移动和重命名操作的示例代码.它们都使用 [Code] procedure CurStepChanged(CurStep: TSetupStep); begin if CurStep = ssInstall then begin // move file if not RenameFile(ExpandConstant('{app}SomeDirSomeFile.exe'),ExpandConstant('{app}SomeFile.exe')) then MsgBox('File moving failed!',mbError,MB_OK); // rename file if not RenameFile(ExpandConstant('{app}SomeFile.exe'),ExpandConstant('{app}RenamedSomeFile.exe')) then MsgBox('File moving failed!',MB_OK); end; end; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |