我有一个Python小程序,位于index.exe文件中。它需要一个图像文件夹,称为 img。
我想使用 NSIS 安装程序安装此程序。我的一般安装看起来像这样:
Outfile "NN-Quicksupport-Installer-Server.exe"
InstallDir $PROGRAMFILES\NN-Quicksupport
Page Components
Page Directory
Page InstFiles
Section "Installiere NN-Quicksupport" SecInstall
SetOutPath $INSTDIR
File "index.exe"
SetOutPath $INSTDIR\img ; Ändere den Ordner-Namen hier
File /r "img\*.*"
SectionEnd
但是现在我想在系统上的所有用户的自动启动中进行此安装,并在安装完成后启动我的应用程序,但我不知道该怎么做。
我在处理 NSIS 方面不是很有经验,而且我在文档中找到的东西并没有像我想要的那样真正对我有用。
我尝试了文档中的一些关于安装后自动启动和启动的操作,但没有任何效果对我有用
RequestExecutionLevel Admin
Name "My Product"
Outfile "NN-Quicksupport-Installer-Server.exe"
InstallDir $PROGRAMFILES\NN-Quicksupport
Page Components
Page Directory
Page InstFiles
Section "Installiere NN-Quicksupport" SecInstall
SetOutPath $INSTDIR
File "index.exe"
WriteUninstaller "$INSTDIR\Uninst.exe"
SetOutPath $INSTDIR\img ; Ändere den Ordner-Namen hier
File /r "img\*.*"
SectionEnd
Section "Run at startup"
SetShellVarContext All
CreateDirectory $SMSTARTUP
CreateShortcut "$SMSTARTUP\$(^Name).lnk" "$INSTDIR\index.exe"
SectionEnd
# A better option is to use the Modern UI interface and the finish page...
Section "Run the program"
Exec '"$INSTDIR\index.exe"'
SectionEnd
Section Uninstall
Delete "$INSTDIR\index.exe"
Delete "$INSTDIR\Uninst.exe"
RMDir /R "$INSTDIR\img"
RMDir $INSTDIR
SetShellVarContext All
Delete "$SMSTARTUP\$(^Name).lnk"
SectionEnd
强制应用程序在启动时为所有用户运行有点粗鲁,也许只是将其限制为当前用户......