[英]When installing the software that was developed using NSIS, how should I throw a pop-up message if installing in server operating systems
When installing the software that was developed using NSIS, how should I throw a pop-up message if installing in server operating systems. 安装使用NSIS开发的软件时,如果在服务器操作系统中安装,应如何抛出弹出消息。
Below are the unsupported operating systems. 以下是不受支持的操作系统。 In those when installing the software i should show the popup message.
在安装软件时,我应该显示弹出消息。
Windows Server 2003
Windows Server 2003 R2
Windows Server 2008
Windows Server 2008 R2
Windows Server 2012
Windows Server 2012 R2
I am facing difficulty to implement this. 我很难实现这一点。 Could any one please guide me on this?
有人可以指导我吗?
You can use WinVer.nsh
to detect Windows versions 您可以使用
WinVer.nsh
来检测Windows版本
!include "LogicLib.nsh"
!include "WinVer.nsh"
Function .onInit
${If} ${IsServerOS}
MessageBox MB_OK "Running on Windows Server."
Quit
${EndIf}
FunctionEnd
If you need to be more specific, you can combine this with at AtLeastWin*
/ AtMostWin*
, where *
is the version you're targeting (eg AtLeastWin2003
/ AtLeastWin2012R2
) 如果您需要更具体,可以将其与
AtLeastWin*
/ AtMostWin*
结合使用,其中*
是您要定位的版本(例如AtLeastWin2003
/ AtLeastWin2012R2
)
Use WinVer.nsh
to detect Windows versions: 使用
WinVer.nsh
检测Windows版本:
!include WinVer.nsh
!include LogicLib.nsh
!define /IfNDef ERROR_INSTALL_REJECTED 1654
Function .onInit
${If} ${IsServerOS}
${If} ${AtLeastWin2003}
${AndIf} ${AtMostWin2012R2}
MessageBox mb_IconStop|mb_OK "Not allowed to run on this version of Windows for some reason!" /SD IDOK
SetErrorLevel ${ERROR_INSTALL_REJECTED}
Quit
${EndIf}
${EndIf}
FunctionEnd
Keep in mind that this does not block the server versions of NT4 and 2000 nor Server 2016. You only need the ${IsServerOS}
check if you want to block all server versions. 请记住,这不会阻止NT4和2000的服务器版本以及Server 2016.如果要阻止所有服务器版本,则只需要
${IsServerOS}
检查。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.