Archive: I can't run my .bat file successfulely!!!HELP!


I can't run my .bat file successfulely!!!HELP!
I make a installer of mysql! When I release the mysql.rar to my $INSTDIR,and write the my.ini file to cofig mysql!
And Then i want to use a .bat file to register the mysql service to the windows or remove the service!
the .bats:
reg.bat :
@echo off
mysqld-nt -install
net start mysql

unreg.bat :
net stop mysql
mysqld-nt -remove

But when i do this:
exec '"$INSTDIR\mysql\reg.bat"'
It display:
'mysqld-nt' is not a external command or internal command,and not a executable file or bat!

But the mysql\bin is in the system path!
and i double click the reg.bat!It run well!
why i can't do it in the scipt!!
By the way, I also use the execCmd and ExecDos plugins!
But the installation crash!!!!

How can i do what i want?


If I were you I will try and write the full path name when calling mysqld-nt, just as a test to make sure it's not a path problem.
Something like:
C:\mysql\bin\mysqld-nt.exe -install


Cheers,


the path is unknow when i haven't install it!
the path of mysql\bin is Add to the System Paths too!


I understand that.
I am just saying for TEST PURPOSES, do one version like this, just to make sure that's not a path problem !

My 2 cents,


It is not a path problem!I am still puzzled now!


If you both install and execute MySQL from the same installer, the MySQL directory won't be in the PATH when you execute it. Running processes aren't updated when the PATH changes. You'll have to find out the full path and use it or execute a new process that'd not inherit the PATH from the installer.


Now my mysql is installed in $INSTDIR/mysql,
and the bin path is $INSTDIR/mysql/bin,now i want the instructions :
"mysqld-nt -install"
and "net satrt mysql"
are executed!
how I can i this??

ExecCmd::exec '"$INSTDIT\mysql\bin\mysqld-nt.exe -install"'
is failed.
and my reg.bat is putted into Diretory :$INSTDIR/mysql
its content is :
cd bin
mysqld-nt.exe -install
net start mysql

Also do wrong!
Can you suggest some available way!!

:(


You have a typo there. It's $INSTDIR, not $INSTDIT. To make sure you got the path right, use IfFileExists or ${If} ${FileExists} to check if the file is really there.

To start the service, you should use one of the available solutions instead of net.exe. They're usually simpler to use.