我已经使用NSIS安装了具有管理权限的应用程序。然后切换到普通用户(没有管理权限)来启动应用程序。但在这里,我没有看到开始菜单和系统托盘。
以下是我使用的代码段:
RequestExecutionLevel admin
; To show the system tray notification
ExecShell "" "$INSTDIR\notification.exe"
; To show the installer icon at the start menu
createDirectory "$SMPROGRAMS\${COMPANYNAME}"
createShortCut "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk" "$INSTDIR\Myapp.exe" "" "$INSTDIR\ProductIcon.ico"
我只需要在安装安装程序时检查Admin用户,而不是启动应用程序。
请帮助我提供显示普通用户的开始菜单和系统托盘所需的更改。
使用SetShellVarContext
将常量切换为“所有用户”/机器模式:
RequestExecutionLevel Admin
Function .onInit
SetShellVarContext All
FunctionEnd
Section
CreateShortcut "$SMPrograms\Test.lnk" "$SysDir\Notepad.exe" ; Created in the shared startmenu folder
SectionEnd
如果希望应用程序在用户登录时启动,请在“启动”文件夹或“运行”注册表项中创建快捷方式。