如何让 NSIS 从临时目录安装和执行文件? [英] How can I get NSIS to install and execute files from a temp directory?

查看:71
本文介绍了如何让 NSIS 从临时目录安装和执行文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下 NSIS 脚本:

I'm using the following NSIS script:

Name "My app wrapper"
Outfile "MyAppSetup.exe"
InstallDir $TEMP\MyApp\Install
Function .onInit
SetSilent silent
FunctionEnd
Section ""
    SetOutPath $TEMP\MyApp\Install
    File installer.msi
    File setup.exe
    Exec setup.exe
SectionEnd

目的是安装程序将这两个文件 installer.msi 和 setup.exe(这是安装先决条件然后调用 installer.msi 的引导程序)打包到 MyApp Setup.exe 文件中.当 MyAppSetup.exe 运行时,它应该将 installer.msi 和 setup.exe 解压到 $Temp\MyApp\Install 目录,并且它应该从该目录运行 setup.exe.

The intention is that the installer will wrap up those two files, installer.msi and setup.exe (which is a bootstrapper to install prereqs and then call installer.msi) into the MyApp Setup.exe file. When MyAppSetup.exe is run, it should extract installer.msi and setup.exe to the $Temp\MyApp\Install directory, and it should run setup.exe from that directory.

但是,当我从桌面运行 MyAppSetup 时,它会执行在桌面上找到的 setup.exe 文件,我什至在 C:\Temp 中看不到 MyApp\Install 目录.

However, when I run MyAppSetup from the desktop, it executes a setup.exe file that it finds on the desktop, and I don't even see a MyApp\Install directory in C:\Temp.

我需要做什么才能让这个脚本将文件安装到正确的位置并执行正确的文件?

What do I need to do to get this script to install the files to the right location and to execute the right file?

推荐答案

我不知道它是否能解决您的问题,但我会写:

I don't know if it would solve your problem but I would write :

Exec $TEMP\MyApp\Instal\setup.exe

您确定 $TEMP 指向 C:/Temp 吗?你检查了吗?

Are you sure that $TEMP is pointing to C:/Temp? Did you check it?

这篇关于如何让 NSIS 从临时目录安装和执行文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆