通过chrome浏览器安装设置文件时,NSIS ExecWait无需等待 [英] NSIS ExecWait dosen't wait when installing the setup file via chrome browser

查看:115
本文介绍了通过chrome浏览器安装设置文件时,NSIS ExecWait无需等待的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下载.exe安装文件(NSIS安装)并通过Chrome打开该文件以执行该文件时,ExecWait无法正常工作.

When downloading the .exe installation file (NSIS installation) and opening it via chrome in order to execute it the ExecWait dosen't work.

我正在运行一个批处理文件,该文件会杀死安装过程中的浏览器进程, 因为我通过chrome(下载管理器)打开了exe文件,所以ExecWait认为执行已结束,因此不必等待执行批处理文件的行之后的下一个ExecWait调用.它认为chrome是父进程,因此它退出了安装.

I'm running a batch file which kill browsers processes inside of the installation, because I opened the exe file via the chrome (Download Manager) the ExecWait think that the execute has ended and therefore dosen't wait for the next ExecWait calls that coming after the line which call to execute the batch file. It think that chrome was the parent process so it quitting the installation.

是否有一种方法可以让ExecWait知道,尽管我杀死了chrome浏览器(或任何其他浏览器)以继续安装?并只等待我通过NSIS脚本执行的.exe文件?

Is there a way to let the ExecWait know that although I killed the chrome browser (or any other browsers) process to continue the installation? and waiting for only the .exe files that I execute via the NSIS script?

P.S-从浏览器(下载管理器)安装.exe文件时,它工作正常.

P.S - When installing the .exe file out of the browser (download manager) it works fine.

编辑(我已包含代码):

# define the name of the installer
outfile "setup.exe"
Name "Example"

installDir $LOCALAPPDATA\Test

# default section
section

setOutPath $INSTDIR
File install.exe
File test.exe

ExecWait $INSTDIR\install.exe
Delete $INSTDIR\install.exe
ExecWait $INSTDIR\test.exe
Delete $INSTDIR\test.exe

sectionEnd

在install.exe(我编译为.exe文件的.bat文件)内部,此代码:

and inside of the install.exe (its a .bat file the I compile to an .exe file) this code:

@echo off
taskkill /F /IM chrome.exe /T

如果您通过chrome下载setup.exe并从底部栏中执行(下载管理器),它将执行install.exe(关闭chrome.exe),但会跳过以下几行:

If you download the setup.exe via chrome and executing it from the bottom bar (download manager) it will execute install.exe (closing chrome.exe) but will skip this lines:

Delete $INSTDIR\install.exe
ExecWait $INSTDIR\test.exe
Delete $INSTDIR\test.exe

推荐答案

ExecWait 始终等待它启动的子进程,但不等待子孙进程.如果需要这样做,可以尝试此宏.

ExecWait always waits for the child process it started but it does not wait for grandchildren. If you need to do that you can try this macro.

恕我直言,杀死这样的浏览器并不是一件很酷的事情(如果他们在选项卡中做重要的事情呢?),您应该要求用户关闭它.

IMHO killing a browser like this is not cool (What if they are doing something important in a tab?), you should just ask the user to close it.

这篇关于通过chrome浏览器安装设置文件时,NSIS ExecWait无需等待的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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