尝试执行 exe 时,NSIS ExecWait 返回 6

发布于 2024-10-18 23:45:01 字数 691 浏览 5 评论 0原文

嗨,我在 NSIS 上遇到了一个恼人的问题。

我正在尝试编写脚本来安装 Office 2007 的 SaveAsPdfAndXps.exe 插件/插件。

这是我的脚本:

Section "SaveAsPdf"
     DetailPrint "Installing SaveAsPdfAndXps Extension"
     File 'Prereq\SaveAsPDFandXPS.exe'
     ExecWait '$TEMP\SaveAsPDFandXPS.exe' $0
     DetailPrint "SaveAsPDFandXPS exit code = $0"
;     Delete '$TEMP\SaveAsPDFandXPS.exe'
SectionEnd

所以我正在运行 Windows 7 x64,我已经安装了安装了此扩展的 Office 07。但是,如果我通过单击并手动安装它来自行运行该exe,它不会中止它,而是会很好地安装。

现在上面的脚本打印出退出代码6!?如果我评论删除位,我在临时目录中看不到该文件?我怎样才能知道发生了什么事?

SaveAsPDFandXPS 扩展在临时目录中输出日志文件。如果手动执行,但脚本不会发生这种情况。

当编译的设置执行时,它确实会要求海拔高度。

问候,

Hi I have an annoying problem with NSIS.

I'm trying to write script to install the SaveAsPdfAndXps.exe plugin/addin for Office 2007.

Here is my script:

Section "SaveAsPdf"
     DetailPrint "Installing SaveAsPdfAndXps Extension"
     File 'Prereq\SaveAsPDFandXPS.exe'
     ExecWait '$TEMP\SaveAsPDFandXPS.exe' $0
     DetailPrint "SaveAsPDFandXPS exit code = $0"
;     Delete '$TEMP\SaveAsPDFandXPS.exe'
SectionEnd

So I'm running Windows 7 x64, I already have Office 07 with this extension installed. However, if I run the exe on my own by clicking it and installing it manually it doesn't abort it just installs nicely.

Now the above script, prints out exit code 6!? And the if I comment the Delete bit, I don't see the file in my temp directory? How do I find out whats going on?

The SaveAsPDFandXPS extension outputs a log file in the temp dir. if executed manually, but it doesn't happen with the script.

When the compiled setup executes, it does ask for elevation btw.

Regards,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

燃情 2024-10-25 23:45:01

您发布的代码不完整, File 指令将文件提取到 $outdir ,除非您使用 /oname 开关, $outdir 由 InstallDir 或 SetOutPath 设置,并且两者都没有出现在您的代码中,因此无法知道您提取到哪里。 ..

尝试将其更改为:

Section "SaveAsPdf"
     DetailPrint "Installing SaveAsPdfAndXps Extension"
     InitPluginsDir
     File '/oname=$PluginsDir\SaveAsPDFandXPS.exe' 'Prereq\SaveAsPDFandXPS.exe'
     ExecWait '"$PluginsDir\SaveAsPDFandXPS.exe"' $0 ;Note the quotes here, if we needed to pass parameters it would be '"c:\path\app.exe" /param'
     DetailPrint "SaveAsPDFandXPS exit code = $0"
     Delete "$PluginsDir\SaveAsPDFandXPS.exe"
SectionEnd

$PluginsDir 永远不会与其他应用程序冲突,$Temp 与其他应用程序共享,因此通常最好将内容放在 $PluginsDir 中。

要在没有提升的情况下运行,请添加 RequestExecutionLevel User

The code you posted is incomplete, the File instruction extracts files to $outdir unless you use the /oname switch, $outdir is set by InstallDir or SetOutPath and neither appear in your code so there is no way to tell where you are extracting to...

Try changing it to:

Section "SaveAsPdf"
     DetailPrint "Installing SaveAsPdfAndXps Extension"
     InitPluginsDir
     File '/oname=$PluginsDir\SaveAsPDFandXPS.exe' 'Prereq\SaveAsPDFandXPS.exe'
     ExecWait '"$PluginsDir\SaveAsPDFandXPS.exe"' $0 ;Note the quotes here, if we needed to pass parameters it would be '"c:\path\app.exe" /param'
     DetailPrint "SaveAsPDFandXPS exit code = $0"
     Delete "$PluginsDir\SaveAsPDFandXPS.exe"
SectionEnd

$PluginsDir will never conflict with other apps, $Temp is shared with other apps, so it is usually better to put things in $PluginsDir.

To run without elevation, add RequestExecutionLevel User

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文