简体   繁体   English

如何使用NSIS为WinZip安装程序设置答案文件/.ini

[英]How to set up answer file/.ini for WinZip installer using NSIS

I am creating an installer that installs several programs and file packages at once, one of these being WinZip, I want the WinZip installer to run in the background, from what I've gathered using /s will make it run in silent mode, BUT the installer still doesn't install. 我正在创建一个同时安装多个程序和文件包的安装程序,其中一个是WinZip,我希望WinZip安装程序在后台运行,使用/s收集/s将使其在静默模式下运行,但安装程序仍然无法安装。 I believe that is because of the selections one must make during the WinZip installation process. 我认为这是因为必须在WinZip安装过程中进行选择。 so my question is how could I set this up to silently install WinZip in the background? 所以我的问题是我该如何设置它在后台静默安装WinZip? would I need an Answer file? 我需要一个答案文件吗? if so how do I get that set-up? 如果是这样,我该如何进行设置? any help would be great! 任何帮助将是巨大的!

*snippet of my code in the NSIS file: *我在NSIS文件中的代码片段:

Section
IfFileExists "C:\Program Files\WinZip\WINZIP32.EXE" Dont_Install 
SetOutPath $TEMP
File "Installerfiles\WinZip165.exe"
DetailPrint "Starting Winzip installation"
ExecWait "/s WinZip165.exe"
Delete $TEMP\WinZip165.exe
SetOutPath $INSTDIR
Goto done
Dont_Install:
MessageBox MB_OK "You seem to have this program \
(WinZip) already installed"  
done:
SectionEnd

*note I have seen the other questions on having a silent install, this question is more WinZip specific and pertaining to how I would establish an answer file if need be. *请注意,我已经看到了其他关于静默安装的问题,该问题更多地是WinZip特定的,并且与我如何根据需要建立答案文件有关。

ExecWait "/s WinZip165.exe" is clearly wrong, it should be ExecWait '"$TEMP\\WinZip165.exe" /S' but I don't think WinZip uses a NSIS based installer... ExecWait "/s WinZip165.exe"显然是错误的,应该是ExecWait '"$TEMP\\WinZip165.exe" /S'但我不认为WinZip使用基于NSIS的安装程序...

They do offer a .MSI, you might want to take a look at that. 他们确实提供了.MSI,您可能想看看。 Their knowledgebase contains some useful tips like this and this . 他们的知识库包含这样一些有用的提示这个这个 You can also find some other tips by googling... 您还可以通过谷歌搜索找到其他技巧...

If you have any other questions about their silent install mode you should probably contact WinZip support . 如果您对他们的静默安装模式有任何其他疑问,则应该联系WinZip支持

Since I can't comment on Anders response because I don't have enough reputation yet, here is the command that I personally use to silently install msi installers, copied right from an installer I have used several times when I want to install multiple programs. 由于我还没有足够的声誉而无法对Anders响应发表评论,因此这是我个人用来静默安装msi安装程序的命令,该命令是从我多次安装多个程序时使用的安装程序复制而来的。

ExecWait '"msiexec" /i "$TEMP\MSI Installer.msi" /qn'

This is assuming that you take Anders advice and try to use the msi version of WinZip. 这是假设您听取了Anders的建议并尝试使用WinZip的msi版本。

Also Anders mentions one of the errors in your code where you don't use a full path to the installer you are trying to run. 另外,安德斯(Anders)提到了代码中的错误之一,其中您没有使用要运行的安装程序的完整路径。 I also wanted to note that it is always a good idea to wrap your paths in single quotes. 我还想指出,将路径用单引号引起来总是一个好主意。 For example when you do: 例如,当您这样做时:

Delete $TEMP\WinZip165.exe

Add single quotes like so: 像这样添加单引号:

Delete '$TEMP\WinZip165.exe'

This also applies when you do your 当您做自己的

SetOutPath '$TEMP'

and

SetOutPath '$INSTDIR'

While you can get away most cases without the single quotes, if you ever come across a path that has spaces in it, it will give you headaches if you are trying to pass the path to a macro or something because it delimits on the spaces and breaks the string into multiple pieces. 虽然您可以不用单引号就能解决大多数情况,但是如果遇到带空格的路径,则尝试将路径传递给宏或其他内容时会感到头痛,因为它限制了空格和将字符串分成多段。 It is just a good habit to get into whenever you are dealing with Windows Paths that may or may not have spaces. 每当您要处理可能带有空格或没有空格的Windows路径时,这都是一个好习惯。

BTW don't accept this answer, I intended it to just be a follow-up to what Anders had already said. 顺便说一句,BTW不接受这个答案,我打算将其作为对安德斯所说的后续措施。

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

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