NSIS:卸载时删除文件夹

发布于 2024-10-17 18:30:44 字数 142 浏览 3 评论 0原文

我想在卸载应用程序时删除 Startmenu\XXX 文件夹和 Program Files\XXX 菜单。

尝试过 RMDir /r 但这对我不起作用。 (Windows 7)

I want to delete the Startmenu\XXX folder and Program Files\XXX menu upon uninstall for the application.

Tried RMDir /r but this does not work for me.
(Windows 7)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

小猫一只 2024-10-24 18:30:44

RMDir 是正确的指令,您的路径可能是错误的。

删除开始菜单的一个常见问题是忘记使用 RequestExecutionLevel,请参阅 NSIS wiki 上的此页面

进程监视器可以帮助您检测路径和权限问题...

RMDir is the correct instruction, your path is probably wrong.

A common issue with startmenu removal is forgetting to use RequestExecutionLevel, see this page on the NSIS wiki

Process Monitor can help you detect path and privilege issues...

巴黎盛开的樱花 2024-10-24 18:30:44

有时,Windows 不允许您删除仍在使用的文件夹。解决方案是将文件夹(和/或文件)标记为在下次系统重新启动时删除。为此,请使用标志 /REBOOTOK

对于文件:

Delete /REBOOTOK "<filename>"

对于文件夹

RMDir /R /REBOOTOK directoryname

下次重新启动后,文件/文件夹将被删除。

另请参阅:http://nsis.sourceforge.net/Reference/RMDir

Occasionally Windows won't let you remove a folder when it's still in use. The solution is to mark the folder (and/or files) for deletion on next system reboot. For this, use the flag /REBOOTOK

For files:

Delete /REBOOTOK "<filename>"

For folders

RMDir /R /REBOOTOK directoryname

After next reboot, the files/folders will be removed.

See also: http://nsis.sourceforge.net/Reference/RMDir

酸甜透明夹心 2024-10-24 18:30:44

这是您的解决方案:
添加“SetShellVarContext all”

http://nsis.sourceforge.net/Shortcuts_removal_fails_on_Windows_Vista

示例代码:

OutFile Win7.exe
Name Win7

Section
  SetShellVarContext all
  CreateDirectory "$SMPROGRAMS\Win7 Testing"
  CreateShortcut  "$SMPROGRAMS\Win7 Testing\win7test.lnk" "$WINDIR\notepad.exe"
  WriteUninstaller "$EXEDIR\uninst.exe"
SectionEnd

Section uninstall
  SetShellVarContext all
  Delete "$SMPROGRAMS\Win7 Testing\win7test.lnk"
  RMDir "$SMPROGRAMS\Win7 Testing"
SectionEnd

-joedf

Here's your solution:
add "SetShellVarContext all"

http://nsis.sourceforge.net/Shortcuts_removal_fails_on_Windows_Vista

Example code:

OutFile Win7.exe
Name Win7

Section
  SetShellVarContext all
  CreateDirectory "$SMPROGRAMS\Win7 Testing"
  CreateShortcut  "$SMPROGRAMS\Win7 Testing\win7test.lnk" "$WINDIR\notepad.exe"
  WriteUninstaller "$EXEDIR\uninst.exe"
SectionEnd

Section uninstall
  SetShellVarContext all
  Delete "$SMPROGRAMS\Win7 Testing\win7test.lnk"
  RMDir "$SMPROGRAMS\Win7 Testing"
SectionEnd

-joedf

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文