简体   繁体   English

安装使用NSIS开发的软件时,如果在服务器操作系统中安装,应如何抛出弹出消息

[英]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.

相关问题 使用NSIS安装软件时,如何设置进度条文本? - When installing the software using NSIS how to set the progress bar text? 在安装软件时,如果特定条件为假,如何使用NSIS回退软件安装过程? - when installing the software, if the specific condition is false How to roll back the software installation process using NSIS? 在安装新版本之前卸载以前的安装程序时,如何使用NSIS隐藏从un.onInit弹出的消息框 - When Uninstalling the previous installer before installing the new how to hide the message box that is popping up from the un.onInit using NSIS 使用NSIS安装软件时如何更改用户帐户控制屏幕文本 - How to change the User Account Control screen text when installing the software using NSIS 使用NSIS安装软件时,如何通过从目标文件夹获取路径来检查驱动器中的空间 - How to check the space in the drive by taking the path from the Destination Folder When installing the software using NSIS 使用NSIS在安全模式下卸载时,如何停止卸载并弹出消息框? - How to stop the uninstallation and pop up a message box when uninstalling in Safe mode using NSIS? 如何使用NSIS安装较新版本的软件之前先卸载较旧版本的软件 - How to uninstall older version of the software before installing the newer version using NSIS 使用NSIS安装字体 - Installing Fonts using NSIS 使用 NSIS 创建和控制服务安装应用程序时安装失败 - Installation is failing when installing the application using NSIS to create and control the service 使用NSIS安装时,如何在“浏览”对话框中仅显示本地驱动器和文件夹? - How to show only local drives and folders from the Browse dialog when installing using NSIS?
相关标签
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM