Skip to content
⌘ NSIS Forum Archive

Create a file

6 posts

DarkLord23#

Create a file

Hello,

Here is what I want to do. During installation process, I have copied a file called install.bat on the INSTDIR. This file is empty.

I would like to open it and add the following content

SET CLASSPATH=$INSTDIR\lib\econf.jar
java be.ac.fundp.infonet.econf.installer.Install $INSTDIR

Close the file and then call it. Would it be possible?

Regards,

Stephane
DarkLord23#
Ok something is easier for me. How can you write

" in a command

for instance I want to show Hello "World!"

How can we do this?
hasty#
How about:

FileOpen $R0 "$INSTDIR\install.bat" a
FileSeek $R0 0 END
FileWrite $R0 "SET CLASSPATH=$INSTDIR\lib\econf.jar"
FileWrite $R0 "java be.ac.fundp.infonet.econf.installer.Install $INSTDIR"
FileClose $R0
ExecWait "$INSTDIR\install.bat"

-H
cchian#
When using FileWrite, how do you tell it to start the next instance of FileWrite in a new line?

When I use the following code:

FileWrite $R0 "@echo off"
FileWrite $R0 "cls"

I end up with "@echo off" and "cls" on the same line.

-Carlos
hasty#
$\r$\n, under Windows at least.

So the above example probably should have been:

FileOpen $R0 "$INSTDIR\install.bat" a
FileSeek $R0 0 END
FileWrite $R0 "SET CLASSPATH=$INSTDIR\lib\econf.jar$\r$\n"
FileWrite $R0 "java be.ac.fundp.infonet.econf.installer.Install $INSTDIR$\r$\n"
FileClose $R0
ExecWait "$INSTDIR\install.bat"
DarkLord23#
Thanks!!!!!

Now i would like to monitor the response code and open a message box different

if errorcode=1 then MB_OK "Installation complete"
if errorcode=2 then MB_OK "An error occured ..."

😁