简体   繁体   English

卸载时 NSIS 不删除文件

[英]NSIS not deleting files when uninstalling

I am having issues deleting files and folders.我在删除文件和文件夹时遇到问题。 3 days to solve this. 3天解决这个问题。 Today i spend 6 hours and still not find the solution.今天我花了 6 个小时,仍然没有找到解决方案。 I am trying to make a simple installer/uninstaller with NSIS without using any variables, macros or complicated stuffs.我正在尝试使用 NSIS 制作一个简单的安装程序/卸载程序,而不使用任何变量、宏或复杂的东西。 My uninstaller is only able to delete the desktop shortcuts.我的卸载程序只能删除桌面快捷方式。

Solutions i tried:我试过的解决方案:

  • searched stackoverflow for posts在 stackoverflow 中搜索帖子
  • tried with /REBOOTOK , delete, RmDir.尝试使用 /REBOOTOK ,删除,RmDir。
  • i checkd 5 times the paths on my PC (windows 10) and i think the paths are correct.我在我的 PC(Windows 10)上检查了 5 次路径,我认为路径是正确的。

this is my nsi script:这是我的 nsi 脚本:

# Nombre del instalador. Aparece en la barra superior al lanzar el instalador.
Name "Cliente de Correo - Stephane"

# El nombre del instalador
OutFile "ClienteCorreoStephane.exe"

# Configuramos la ruta por defecto donde se instala. Se puede usar $DESKTOP para
#el escritorio
InstallDir $PROGRAMFILES\ClienteCorreoStephane

# Pedimos permisos para Windows. se puede usar "user" pero
#lo normal es usar "admin" para tener todos los permisos
RequestExecutionLevel admin

# Pantallas que hay que mostrar del instalador
# te saca una ventana preguntando en que directorio quieres instalar
# Si pones páginas, hay que poner esas 2 como mínimo. Existen más paginas.
Page directory
Page instfiles

#Cambiar el idioma
!include "MUI.nsh"
!insertmacro MUI_LANGUAGE "Spanish"


#Seccion principal
Section

# muestra una ventanita con un texto y un botón que pone "Hola Mundo" y
# un botón de "ok". El instalador no continúa hasta que pulses el botón.
messageBox MB_OK "Gracias por instalar el cliente de correos de Stephane"

# Establecemos la ruta de instalacion al directorio de instalacion
SetOutPath $INSTDIR\files

# Creamos el desinstalador
writeUninstaller "$INSTDIR\files\uninstall.exe"

# anadimos a nuestro paquete instalador los siguientes archivos
File /r ".\clienteCorreoDefinitivo_jar\*" #aqui anade todo mi proyecto
File /r "..\..\ayuda" #anade la carpeta ayuda que esta fuera del src
File /r "..\..\informes" #anade la carpeta informes que esta fuera del src
File /r "..\..\recursos" #anade la carpeta informes que esta fuera del src

# anadiremos nuestro JavaFX y JRE. Para eso cambiaremos el setoutpath. Recordar cambiar
# el nombre de las carpetas del setoutpath.
# aquí anadimos nuestro javaFX
SetOutPath $INSTDIR\files\javafx13 #Este nos crea una carpeta javafx13 y nos mete todo lo siguiente dentro
File /r "C:\Program Files\Java\javafx13\*"
# aquí anadimos nuestr JRE
SetOutPath $INSTDIR\files\java-runtime #Este nos crea una carpeta java-runtime y nos mete todo lo siguiente dentro
File /r "C:\Program Files\Java\jdk-13\bin\java-runtime\*"


#Añadimos información para que salga en el menú de desinstalar de Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ClienteCorreosStephane" \
             "DisplayName" "ClienteCorreoStephane"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ClienteCorreosStephane" \
             "Publisher" "Stephane - Desarrollo Interfaces"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ClienteCorreosStephane" \
             "UninstallString" "$\"$INSTDIR\uninstall.exe$\""

# Creamos un acceso directo apuntando al desinstalador
createShortCut "$SMPROGRAMS\Desinstalar.lnk" "$INSTDIR\files\uninstall.exe"
createShortCut "$DESKTOP\Desinstalar.lnk" "$INSTDIR\files\uninstall.exe"
createShortCut "$DESKTOP\ClienteCorreoStephane.lnk" "$INSTDIR\files\java-runtime\bin\java.exe --module-path ..\..\javafx13\lib --add-modules javafx.controls,javafx.fxml,javafx.graphics,javafx.web,javafx.base --add-opens=javafx.graphics/javafx.scene=ALL-UNNAMED -jar ..\..\clienteCorreoDefinitivo.jar" "$INSTDIR\files\recursos\mierda_icon.ico"

SetOutPath $INSTDIR
# Fin de la seccion
SectionEnd

# seccion del desintalador. Siempre se llamará uninstall
section "uninstall"

# borramos el desintalador primero. No pasa nada, seguirá funcionando
# aunque se disinstale a si mismo.
#delete "$INSTDIR\files\uninstall.exe"

# borramos el directorio files
#RmDir /r /REBOOTOK "$INSTDIR\files"
RmDir /r "$INSTDIR\files"

# borramos el directorio general. si quedan archivos dentro, no lo borrará
RmDir /REBOOTOK "$INSTDIR"

# Borramos la entrada del registro
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ClienteCorreosStephane"

# borramos el acceso directo del menu de inicio
delete "$SMPROGRAMS\Desinstalar.lnk"
delete "$DESKTOP\Desinstalar.lnk"
delete "$DESKTOP\ClienteCorreoStephane.lnk"

# fin de la seccion del desinstalador
sectionEnd

I also had issues loading my jar file with the desktop shortcut.我在使用桌面快捷方式加载 jar 文件时也遇到了问题。 How do I solve this too?我也怎么解决这个问题?

卸载$Instdir中的$Instdir是卸载 .exe 文件所在的文件夹,而不是它在安装程序中的值。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 卸载时未从 NSIS 安装程序调用 DLL 函数 - DLL Function is not calling from the NSIS installer when uninstalling 卸载 NSIS 安装程序时如何更改位图图像 - How to change the bitmap image when uninstalling the NSIS installer 使用NSIS在安全模式下卸载时,如何停止卸载并弹出消息框? - How to stop the uninstallation and pop up a message box when uninstalling in Safe mode using NSIS? 使用NSIS卸载以前的Wix安装程序时,将花费更长的时间,并且应用程序标题栏显示“ Not Responding” - When Uninstalling the previous Wix installer using NSIS it is taking longer time and the application title bar is showing “Not Responding” 卸载前检查应用程序是否在 NSIS 中运行 - Checking if the application is running in NSIS before uninstalling 使用 NSIS 卸载 Windows 注册表项时,我们是否需要从 Windows 注册表中删除每个条目? - When uninstalling the windows registry entry using NSIS, do we need to remove each and every entry from the windows registry? 在安装新版本之前卸载以前的安装程序时,如何使用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:卸载时删除文件夹 - NSIS: Deleting a folder upon uninstall 卸载后不删除nsis快捷方式 - nsis shortcuts not deleting after uninstall 删除 NSIS 上的注册表项和值 - Deleting the Registry key & values on NSIS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM