我已经创建了UPSTest.NSI文件。在此文件中,我包括了所需的dll和exe,如下所示,并且还添加了所需的 commnads。
File E:\Code\PCPE\Install\pcpe301\Common\ValidateUPS.exe
File E:\Code\PCPE\Install\pcpe301\Common\drvutil.dll
File E:\Code\PCPE\Install\pcpe301\Common\ntutil.dll
File E:\Code\PCPE\Install\pcpe301\Common\pdcdll.dll
最后,我已经加载了这个NSI脚本文件,它生成了UPSTest.exe
我运行此UPSTest.exe,它已在路径(\ Program Files \ UPSTest)中生成了以下dll和exe以及卸载exe
drvutil.dll
ntutil.dll
pdcdll.dll
ValidateUPS.exe
uninstall.exe
但是当我运行ValidateUPS.exe时,它没有打开应用程序(没有响应)
下面是完整的代码:(UPSTest.nsi)
; UPSTest.nsi
;
;
; It will install UPSTest.nsi into a directory that the user selects.
;--------------------------------
; The name of the installer in the path C:\Program Files\UPSTest
Name "UPSTest"
; The file to write in the path E:\Code\PCPE\NULLSOFT\src
OutFile "UPSTest.exe"
; The default installation directory in the path C:\Program Files\UPSTest
InstallDir $PROGRAMFILES\UPSTest
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically) It shows the path the path C:\Program Files\UPSTest
InstallDirRegKey HKLM "Software\NSIS_UPSTest" "Install_Dir"
; Request application privileges for Windows Vista
RequestExecutionLevel admin
;--------------------------------
; Pages
Page components
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
;--------------------------------
; The stuff to install
Section "UPSTest (required)"
SectionIn RO
DetailPrint "Testing UPS"
; Set output path to the installation directory. Here is the path C:\Program Files\UPSTest
SetOutPath $INSTDIR
; Give the dll and exe path
File E:\Code\PCPE\Install\pcpe301\Common\ValidateUPS.exe
File E:\Code\PCPE\Install\pcpe301\Common\drvutil.dll
File E:\Code\PCPE\Install\pcpe301\Common\ntutil.dll
File E:\Code\PCPE\Install\pcpe301\Common\pdcdll.dll
; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\NSIS_UPSTest "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UPSTest" "DisplayName" "NSIS UPSTest"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UPSTest" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UPSTest" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UPSTest" "NoRepair" 1
WriteUninstaller "uninstall.exe"
SectionEnd
; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts"
CreateDirectory "$SMPROGRAMS\UPSTest"
CreateShortcut "$SMPROGRAMS\UPSTest\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortcut "$SMPROGRAMS\UPSTest\UPSTest (MakeNSISW).lnk" "$INSTDIR\UPSTest.nsi" "" "$INSTDIR\UPSTest.nsi" 0
SectionEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UPSTest"
DeleteRegKey HKLM SOFTWARE\NSIS_UPSTest
; Remove files and uninstaller
Delete $INSTDIR\UPSTest.nsi
Delete $INSTDIR\uninstall.exe
; Remove shortcuts, if any
Delete "$SMPROGRAMS\UPSTest\*.*"
; Remove directories used
RMDir "$SMPROGRAMS\UPSTest"
RMDir "$INSTDIR"
SectionEnd
请让我知道我错过了什么。我们还需要添加任何内容来启动该应用程序吗?请建议我提供的.nsi文本脚本文件是否有任何更改。
答案 0 :(得分:0)
您的rails
调用是错误的,它指向.nsi文件。它应该指向CreateShortcut
。
您的$InstDir\ValidateUps.exe
调用也是错误的,删除.nsi没有意义,它应该删除您的.exe和.dll文件。
无论您的应用程序是否正常运行,NSIS都不应有所作为,问题很可能是在其他地方。也许您需要注册.dll文件或其他配置更改。