NSIS 中的卸载脚本

发布于 2024-11-10 07:21:15 字数 950 浏览 2 评论 0原文

我是编写安装程序/卸载程序的新手。我需要一个卸载程序来删除存储在日志文件(文本文件)中的文件。我正在尝试使用 NSIS 脚本实现该功能,但我无法执行以下链接: http://nsis.sourceforge.net/Talk:Uninstall_only_installed_files 基本上我需要实现以下四行代码:

OutFile "dummy.exe" 
Section "Uninstall"
!include "unlist.txt"
!system 'del unlist.txt'
SectionEnd

include 语句显示错误,因为我在 unlist.txt 中附加了格式错误的文件名。

编译结果:

OutFile: "dummy.exe"
Section: "Uninstall"
!include: "unlist.txt"
File: "Test1.txt" [compress] 4 bytes
File: "Test2.txt" [compress] 0/4 bytes
File: "Test3.txt" [compress] 0/4 bytes
File: "Test4.txt" [compress] 0/4 bytes
!include: closed: "unlist.txt"
SectionEnd

处理了 1 个文件,写入输出:

Error: invalid script: no sections specified
Error - aborting creation process

任何人都可以告诉我正确的脚本或需要在 unlist.txt 中提及正确的文件格式吗?

感谢您的帮助。

此致, 彼得

I am a newbie in writing an installer/uninstaller. I need an uninstaller to delete the files stored in the log file (text file). I am trying to implement the functionality using NSIS script but I couldn't though I followed the below link :
http://nsis.sourceforge.net/Talk:Uninstall_only_installed_files
Basically I need to implement the following four lines of code:

OutFile "dummy.exe" 
Section "Uninstall"
!include "unlist.txt"
!system 'del unlist.txt'
SectionEnd

The include statement shows an error as I've appended the file names with wrong format in unlist.txt .

Compilation result:

OutFile: "dummy.exe"
Section: "Uninstall"
!include: "unlist.txt"
File: "Test1.txt" [compress] 4 bytes
File: "Test2.txt" [compress] 0/4 bytes
File: "Test3.txt" [compress] 0/4 bytes
File: "Test4.txt" [compress] 0/4 bytes
!include: closed: "unlist.txt"
SectionEnd

Processed 1 file, writing output:

Error: invalid script: no sections specified
Error - aborting creation process

Can anyone advise me with a correct script or the correct format of file need to be mentioned in the unlist.txt ?

Thanks for your help.

Best Regards,
Peter

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

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

发布评论

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

评论(1

同展鸳鸯锦 2024-11-17 07:21:15

您的安装程序至少需要如下所示:

OutFile "dummy.exe"

Section 01
# This is install section
WriteUninstaller "Uninstall.exe"
SectionEnd

Section "Uninstall"
!include "unlist.txt"
!system 'del unlist.txt'
SectionEnd

必须存在一个安装部分,并创建简单的卸载程序(在临时目录中)。
您需要指定更多代码才能正常工作:例如设置 $INSTDIR 等。

Your installer need to look at least like this:

OutFile "dummy.exe"

Section 01
# This is install section
WriteUninstaller "Uninstall.exe"
SectionEnd

Section "Uninstall"
!include "unlist.txt"
!system 'del unlist.txt'
SectionEnd

One install section must exists and simple uninstaller is created (in temp directory).
You need to specify more code to work correctly: e.g. set $INSTDIR etc.

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