【发布时间】:2011-09-06 06:56:30
【问题描述】:
在我的安装程序中,我想创建一个空文件。在 linux 中我会使用 touch 命令,但在 NSIS 中最简单的方法是什么?
【问题讨论】:
标签: nsis
在我的安装程序中,我想创建一个空文件。在 linux 中我会使用 touch 命令,但在 NSIS 中最简单的方法是什么?
【问题讨论】:
标签: nsis
#Compile time
!appendfile "$%temp%\compiletimefile.txt" ""
;Or if you need to force the file to be empty
!appendfile "$%temp%\compiletimefile.txt" ""
!delfile "$%temp%\compiletimefile.txt"
!appendfile "$%temp%\compiletimefile.txt" ""
#Run time, method 1
FileOpen $0 "$temp\runtimefile1.txt" w
FileClose $0
#Run time, method 2
File "/oname=$temp\runtimefile2.txt" "$%temp%\compiletimefile.txt"
【讨论】:
使用这个简单的代码来创建一个空文件。此外,将它放在任何功能块中对调试都有很大帮助。
StrCpy $9 "hello world"
FileOpen $8 "$DESKTOP\test_1.txt" w ;Opens a Empty File and fills it
FileWrite $8 "$9"
FileClose $8 ;Closes the filled file
【讨论】: