atliano
24th May 2011 08:34 UTC
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
24th May 2011 10:01 UTC
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
24th May 2011 10:17 UTC
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
Afrow UK
24th May 2011 10:36 UTC
I've just explained how to do it.
Stu
Afrow UK
24th May 2011 10:38 UTC
Your other option is to replace tokens in your batch file with WordReplace.
Stu