简体   繁体   English

复制文件,然后将其包含在安装程序包NSIS中

[英]Copy file before include it in the installer package NSIS

For example I have a config file in D:\\Project\\InstallerPro\\Platform\\Windows8\\Web.config I need to move that file to D:\\Project\\InstallerPro\\Web\\Configuration\\Web.config if the windows version is windows 8 例如,我在D:\\ Project \\ InstallerPro \\ Platform \\ Windows8 \\ Web.config中有一个配置文件,如果Windows版本是Windows 8,则需要将该文件移至D:\\ Project \\ InstallerPro \\ Web \\ Configuration \\ Web.config。

After that, the installer will be generated from a nsi script in D:\\Project\\InstallerPro\\PROinst.nsi 之后,安装程序将从D:\\ Project \\ InstallerPro \\ PROinst.nsi中的nsi脚本生成。

Is it possible to copy the files (not manually) before compiling it into an installer using NSIS? 使用NSIS将文件编译到安装程序之前,是否可以复制文件(而不是手动)?

I want to do something like this: 我想做这样的事情:

CopyFiles ".\Source\Platform\Windows8\Web.config" ".\Source\WEB\Configuration\Web.config"

CopyFiles is a runtime command, ie a command that will run during the installer execution and not during the installer creation. CopyFiles是运行时命令,即将在安装程序执行期间而不是在安装程序创建期间运行的命令。

You could use the !system command that is executed during the compilation of the installer, eg: 您可以使用在安装程序编译期间执行的!system命令,例如:

!system `copy "c:\Source\Platform\Windows8\Web.config" "c:\Source\WEB\Configuration\Web.config"`

You will need to use absolute paths as the current working dir is from makensis.exe and not from the script being compiled. 您将需要使用绝对路径,因为当前的工作目录来自makensis.exe而不是来自正在编译的脚本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM