Windows 安装程序 (NSIS) 生成应用程序后无法打开应用程序

我创建了一个 PowerTest.NSI 文件。在这个文件中,我包含了所需的 dll 和 exe,如下所示,还添加了所需的 commnads。

  File E:\Source\PowerTest.exe
  File E:\Source\testutil.dll
  File E:\Source\ntutil.dll

最后我加载了这个 NSI 脚本文件,它生成了 PowerTest.exe

我运行这个 PowerTest.exe,它在路径 (\Program Files\PowerTest) 中生成了以下 dll 和 exe 以及卸载 exe

但是当我运行可执行文件时,它没有打开应用程序(它没有响应)

以下是完整代码:(PowerTest.nsi)

; PowerTest.nsi
;
;
; It will install PowerTest.nsi into a directory that the user selects.

;--------------------------------

; The name of the installer in the path C:\Program Files\PowerTest
Name "UPowerTestPSTest"

; The file to write  in the path E:\Source
OutFile "PowerTest.exe"

; The default installation directory in the path C:\Program Files\PowerTest
InstallDir $PROGRAMFILES\PowerTest

; 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\PowerTest
InstallDirRegKey HKLM "Software\PowerTest" "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 "PowerTest(required)"

  SectionIn RO
  
  DetailPrint "PowerTest"

  ; Set output path to the installation directory. Here is the path C:\Program Files\PowerTest
  SetOutPath $INSTDIR

  ; Give the dll and exe path
  File E:\Source\PowerTest.exe
  File E:\Source\testutil.dll
  File E:\Source\ntutil.dll

  ; Write the installation path into the registry
  WriteRegStr HKLM SOFTWARE\PowerTest"Install_Dir" "$INSTDIR"

  ; Write the uninstall keys for Windows
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\PowerTest" "DisplayName" "NSIS PowerTest"
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\PowerTest" "UninstallString" '"$INSTDIR\uninstall.exe"'
  WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\PowerTest" "NoModify" 1
  WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\PowerTest" "NoRepair" 1
  WriteUninstaller "uninstall.exe"

SectionEnd

; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts"

  CreateDirectory "$SMPROGRAMS\PowerTest"
  CreateShortcut "$SMPROGRAMS\PowerTest\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
  CreateShortcut "$SMPROGRAMS\PowerTest (MakeNSISW).lnk" "$INSTDIR\PowerTest.nsi" "" "$INSTDIR\PowerTest.nsi" 0

SectionEnd

;--------------------------------

; Uninstaller

Section "Uninstall"

  ; Remove registry keys
  DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\PowerTest"
  DeleteRegKey HKLM SOFTWARE\PowerTest

  ; Remove files and uninstaller
  Delete $INSTDIR\PowerTest.nsi
  Delete $INSTDIR\uninstall.exe

  ; Remove shortcuts, if any
  Delete "$SMPROGRAMS\PowerTest\*.*"

  ; Remove directories used
  RMDir "$SMPROGRAMS\PowerTest"
  RMDir "$INSTDIR"

SectionEnd

请让我知道我错过了什么。我们还需要添加任何东西来启动应用程序吗?请建议我提供的 .nsi 文本脚本文件是否有任何更改。

不同的

你的CreateShortcut调用是错误的,它指向一个 .nsi 文件。它应该指向$InstDir\PowerTest.exe.

您的Delete调用也是错误的,删除 .nsi 没有意义,它应该删除您的 .exe 和 .dll 文件。

NSIS 不应该对您的应用程序是否有效产生影响,问题很可能出在其他地方。也许您需要注册 .dll 文件或其他一些配置更改。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

使用NSIS将应用程序文件安装到标准Windows用户

来自分类Dev

如何从C#应用程序调用cmd生成nsis安装程序?

来自分类Dev

如何从C#应用程序调用cmd生成nsis安装程序?

来自分类Dev

NSIS安装程序俄语

来自分类Dev

Windows 8.1:打开Metro应用程序后PC崩溃

来自分类Dev

安装后在Windows启动时运行的应用程序

来自分类Dev

安装后在Windows启动时运行的应用程序

来自分类Dev

Windows Phone 8.1 HTML公司应用程序-无法安装公司应用程序

来自分类Dev

Windows应用程序更改类型后,应用程序无法正常工作

来自分类Dev

使用Chef安装Windows应用程序

来自分类Dev

使用Chef安装Windows应用程序

来自分类Dev

在Windows 10上安装应用程序

来自分类Dev

无法在Windows上生成Phoenix应用程序

来自分类Dev

无法在Windows上生成Phoenix应用程序

来自分类Dev

Windows更新后还原应用程序的声音(无需更新驱动程序或重新安装应用程序)

来自分类Dev

ShowWindow生成意外的Windows /应用程序

来自分类Dev

ShowWindow生成意外的Windows /应用程序

来自分类Dev

从NSIS安装程序运行应用程序时File.Exists不起作用

来自分类Dev

NSIS安装程序应用程序名称未正确显示

来自分类Dev

VB6应用程序Windows 7安装后对于标准用户无法正常工作

来自分类Dev

为C#Windows应用程序准备安装程序

来自分类Dev

使用 NSIS 创建和控制服务安装应用程序时安装失败

来自分类Dev

使用“ Visual Studio安装程序”创建的安装程序安装后,无法打开应用程序

来自分类Dev

安装后无法打开Android TV应用程序

来自分类Dev

安装后无法打开Android TV应用程序

来自分类Dev

Windows 10:应用程序无法完成UN安装,并保留在应用程序列表中

来自分类Dev

根据安装程序的NSIS卸载程序特权

来自分类Dev

Windows Update秘密安装的Windows Store应用程序

来自分类Dev

登录Windows应用程序

Related 相关文章

  1. 1

    使用NSIS将应用程序文件安装到标准Windows用户

  2. 2

    如何从C#应用程序调用cmd生成nsis安装程序?

  3. 3

    如何从C#应用程序调用cmd生成nsis安装程序?

  4. 4

    NSIS安装程序俄语

  5. 5

    Windows 8.1:打开Metro应用程序后PC崩溃

  6. 6

    安装后在Windows启动时运行的应用程序

  7. 7

    安装后在Windows启动时运行的应用程序

  8. 8

    Windows Phone 8.1 HTML公司应用程序-无法安装公司应用程序

  9. 9

    Windows应用程序更改类型后,应用程序无法正常工作

  10. 10

    使用Chef安装Windows应用程序

  11. 11

    使用Chef安装Windows应用程序

  12. 12

    在Windows 10上安装应用程序

  13. 13

    无法在Windows上生成Phoenix应用程序

  14. 14

    无法在Windows上生成Phoenix应用程序

  15. 15

    Windows更新后还原应用程序的声音(无需更新驱动程序或重新安装应用程序)

  16. 16

    ShowWindow生成意外的Windows /应用程序

  17. 17

    ShowWindow生成意外的Windows /应用程序

  18. 18

    从NSIS安装程序运行应用程序时File.Exists不起作用

  19. 19

    NSIS安装程序应用程序名称未正确显示

  20. 20

    VB6应用程序Windows 7安装后对于标准用户无法正常工作

  21. 21

    为C#Windows应用程序准备安装程序

  22. 22

    使用 NSIS 创建和控制服务安装应用程序时安装失败

  23. 23

    使用“ Visual Studio安装程序”创建的安装程序安装后,无法打开应用程序

  24. 24

    安装后无法打开Android TV应用程序

  25. 25

    安装后无法打开Android TV应用程序

  26. 26

    Windows 10:应用程序无法完成UN安装,并保留在应用程序列表中

  27. 27

    根据安装程序的NSIS卸载程序特权

  28. 28

    Windows Update秘密安装的Windows Store应用程序

  29. 29

    登录Windows应用程序

热门标签

归档