如何使用NSIS创建空文件

时间:2011-09-06 06:56:30

标签: nsis

在我的安装程序中,我想创建一个空文件。在linux中我会使用touch命令,但在NSIS中最简单的方法是什么?

1 个答案:

答案 0 :(得分:10)

#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"