Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 24th May 2011, 07:34   #1
atliano
Junior Member
 
Join Date: May 2011
Posts: 9
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
atliano is offline   Reply With Quote
Old 24th May 2011, 09:01   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
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

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 24th May 2011, 09:17   #3
atliano
Junior Member
 
Join Date: May 2011
Posts: 9
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
atliano is offline   Reply With Quote
Old 24th May 2011, 09:36   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
I've just explained how to do it.

Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 24th May 2011, 09:38   #5
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
Your other option is to replace tokens in your batch file with WordReplace.

Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump