NSIS:将 1 个文件复制到另一个文件(不包括行)时出现问题
我想将文件 1.txt 替换为其原始内容,但 R1 中的行除外,为此我编写了以下代码:
FileOpen $0 "1.txt" "r"
GetTempFileName $R0
FileOpen $1 $R0 "w"
loop:
FileRead $0 $2
IfErrors done
strcmp $R1 $2 loop here
here:
FileWrite $1 $2
Goto loop
done:
FileClose $0
FileClose $1
Delete "1.txt"
CopyFiles /SILENT $R0 "1.txt"
Delete $R0
但它无法正常工作,它保持 1.txt 原样。有人可以帮我找出问题出在哪里吗?
I want to replace the file 1.txt with its original contents except the line in R1, for which I wrote the following code:
FileOpen $0 "1.txt" "r"
GetTempFileName $R0
FileOpen $1 $R0 "w"
loop:
FileRead $0 $2
IfErrors done
strcmp $R1 $2 loop here
here:
FileWrite $1 $2
Goto loop
done:
FileClose $0
FileClose $1
Delete "1.txt"
CopyFiles /SILENT $R0 "1.txt"
Delete $R0
But its not working properly, it keeps 1.txt as it is. Can somebody please help me to find out where is the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我刚刚遇到了同样的问题。通过插入修复它
清除错误
“循环:”之前的命令
I have just ran into the same problem. Fixed it by inserting a
ClearErrors
command before "loop:"