Skip to content
⌘ NSIS Forum Archive

Problem writing to a text file

4 posts

jfha73#

Problem writing to a text file

I have this script:


FileOpen $4 "file.txt" w
FileWrite $4 'Line 1 with "something in quotes"$\r$\n'
FileWrite $4 "Line 2$\r$\n"
FileWrite $4 "Line 3$\r$\n"
FileWrite $4 "Line 4$\r$\n"
FileWrite $4 "Line 5 with a $$ in it$\r$\n"
FileWrite $4 "Line 6$\r$\n"
I do get a .bak file in the folder where the file is, but nothing gets added to the file.

Any ideas?
Anders#
There is no way a .bak file is created by this code. You should also use a full path to "file.txt" just to be on the safe side...
jfha73#
The path of the file is in the openfile line, I just didn't put it in the sample above, and if it doesn't create a .back (not .bak) file, then something must be doing it, but the fact is that the file I want to ad the text gets copied to file.txt.back in the path where it is, just nothing is inserted to the file.txt.