sam20_78
17th February 2006 15:03 UTC
Modifying a bat file
Hey Guys,
This is what I plan to do. We have a product which is already installed on the client machines. Its a java based client which runs through a bat file. now We need to send more updates to the Clients and We also need to make the changes in the bat file that is used to run the client program. I want to add REM in front of few lines and at the end of bat file i want to add few lines.
Now my question is how to achive this. I've seen various functions which will replace the text in a bat file. Can anyone please tell me how should i proceed.
Any help would be highly appreciated.
Thanks in advance.
sam20_78
17th February 2006 16:35 UTC
No response :(
i'm able to add the REM comments in the bat file using one of the functions that i found here
http://nsis.sourceforge.net/More_adv...e_text_in_file
now my question is how do i add some text at the end of the bat file. please help me.
Thanks in advance.
sam20_78
17th February 2006 17:09 UTC
dienjd,
Thanks a lot for showing me the way to do it.
Following code worked like a charm.
FileOpen $0 "path\to\file.txt" a
FileSeek $0 0 END
FileWrite $0 $1
FileClose $0
One more question. above code all adds the to a single line(i'm writing multiple lines using the File write.
it starts writing where the line ends not from the newline how do i write to the newline. Sorry if you find this a dumb question. i'm totally new to NSIS and have started playing with only yesterday.
Thanks again for you help
dienjd
17th February 2006 17:16 UTC
I was just the messenger on that one; it was Afrow_UK's code :)
To create a new line put a "$\r$\n" before each new line of text you want in your file.
sam20_78
17th February 2006 17:40 UTC
Thanks a lot man. You saved my day. Appreciate your help :)