Skip to content
⌘ NSIS Forum Archive

Edit Batch file before executing

5 posts

atliano#

Edit Batch file before executing

Hello All,

I am having problem in sending values to batch file while running nsis script...
I want to run database script files which i have written in batch file and i want this batch file to be executed with nsis script by seting values of dbuser,dbpswd,dbname in nsis script..Can any one know??

My batch file looks like(abc.bat):=
set /P dbuser=Enter DB user name :
set /P dbpswd=Enter DB password :
set /p dbname=Enter DB Name/SID :

echo Connecting to the Database..
mysql -u%dbuser% -p%dbpswd% %dbname% < 1.1\MySql\1.sql 2>
%temp%\OVMySQLDBInstall1.log

mysql -u%dbuser% -p%dbpswd% %dbname% < 1.2\MySql\1.sql 2> %temp%\OVMySQLDBInstall3.log


Thanks
Afrow UK#
Rather than including the batch file with File and then modifying it afterwards, just generate the batch file using FileOpen/FileWrite/FileClose. You can use variables wherever you require them.

Edit: If you're not installing the batch file, why use one at all? Just call mysql.exe directly using ExecDos (which provides piping to a log file).

Stu
atliano#
Hello Afrow,

my batch file have around 20 script commands and for connection purpose i want to give db name ,dbuser and dbpwd through registry or i have also wriiten a page in installer which asked for the connection parameters(dbuser,dbname,dbpwd) and i want not to repeat these parameters in batch file...it would be better help if u suggest how to pass values in db parameters of batch file from nsis script variable..
Thanks