Skip to content
⌘ NSIS Forum Archive

Modifying a bat file

6 posts

sam20_78#

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#
No response 🙁

i'm able to add the REM comments in the bat file using one of the functions that i found here


now my question is how do i add some text at the end of the bat file. please help me.

Thanks in advance.
dienjd#
This covers it:
Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.
sam20_78#
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#
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.