简体   繁体   English

通过NSIS Envar-plugin设置环境变量

[英]Setting environment variable through NSIS Envar-plugin

I have a custom installer created through NSIS. 我有一个通过NSIS创建的自定义安装程序。

I have the following Ant task doing the same: 我有以下Ant任务做同样的事情:

<target name="buildNSIS">
    <exec executable="D:\NSIS\nsis-binary\makensis.exe" failonerror="true" >
      <!-- providing some nsis definitions -->
      <arg value="/DPROJECT_NAME=${ant.project.name}"/>
      <!-- passing the script -->
      <arg value=".\installer\MySetup.nsi"/>
    </exec>
</target>

where MySetup.nsi is the script to run through NSIS for the installer. 其中MySetup.nsi是通过NSIS运行安装程序的脚本。

I want to set an environment variable as part of the install process. 我想在安装过程中设置一个环境变量。

I read that its best to do using: https://nsis.sourceforge.io/EnVar_plug-in 我读到最好用的方法: https//nsis.sourceforge.io/EnVar_plug-in

However, the instruction there is confusing. 但是,那里的指令令人困惑。 It just says: Just extract the contents to your nsis directory (usually '$PROGRAMFILES\\NSIS') 它只是说: 只需将内容提取到你的nsis目录(通常是'$ PROGRAMFILES \\ NSIS')

What does it mean? 这是什么意思?

My D:\\NSIS\\nsis-binary directory looks like: 我的D:\\NSIS\\nsis-binary目录如下所示:

在此输入图像描述

So do I unzip Envar_plugin.zip inside Plugins directory above and start using EnVar::AddValue or EnVar::AddValueEx functions inside my MySetup.nsi as mentioned in Envar_plugin examples? 那么我Envar_plugin.zip在上面的Plugins目录中解压缩Envar_plugin.zip并开始在我的MySetup.nsi使用EnVar::AddValueEnVar::AddValueEx函数,如Envar_plugin示例中所述?

How do I use Envar_plugin so that my resultant custom installer through MySetup.nsi for my software will set environment variables during installation of my software? 如何使用Envar_plugin以便通过MySetup.nsi为我的软件生成的自定义安装程序将在安装我的软件期间设置环境变量?

Plug-ins have to be installed in the correct plug-in subdirectory inside the NSIS folder. 插件必须安装在NSIS文件夹内的正确插件子目录中。 Some plug-ins only have a .DLL file in the root of the .ZIP file and some already have the correct directory tree in the .ZIP. 某些插件只在.ZIP文件的根目录中有一个.DLL文件,而某些插件在.ZIP中已经有正确的目录树。 This specific plug-in has the latter and you can just extract the contents to your main NSIS folder. 此特定插件具有后者,您只需将内容提取到主NSIS文件夹即可。

If you try to execute a plug-in command ( name::function ) and NSIS cannot find the plug-in then you most likely put the .DLL file in the wrong folder. 如果您尝试执行插件命令( name::function )并且NSIS找不到插件,那么您很可能将.DLL文件放在错误的文件夹中。 Recent versions of NSIS will print a list of directories it tried to search when this happens. NSIS的最新版本将打印出发生这种情况时尝试搜索的目录列表。

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

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