Read, edit a single line in a file?
Is it possible for NSIS to edit a single line in a file? Like overwrite line 2 of runmefirst.bat with "move ..\setup\*.* .\setup32"
5 posts
FileOpen $0 "file.txt" r
GetTempFileName $R0
FileOpen $1 $R0 w
loop:
FileRead $0 $2
IfErrors done
StrCmp $2 "line to replace$\r$\n" 0 +3
FileWrite $1 "replacement of line$\r$\n"
Goto loop
FileWrite $1 $2
Goto loop
done:
FileClose $0
FileClose $1
Delete "file.txt"
CopyFiles /SILENT $R0 "file.txt"
Delete $R0