Archive: execshell problem


execshell problem
Hello,

ive got a question about using execshell.

-ExecShell open '"$INSTDIR\php\php.exe"' '"$INSTDIR\php\myfile.php"'
-ExecShell open "$INSTDIR\apache\apache" "-i"
-ExecShell open "$INSTDIR\apache\apache" "-k start -n Apache"
these are working fine.

ExecShell open '"$INSTDIR\mysql\bin\mysql"' '"databasename < $INSTDIR\mysql\bin\myfile.sql"'
but this one doesnt work correctly. (tried with(out)'"). Its seeing the whole commandline as the databasename instead of the first part of the line.

im using a .bat file now but i would like to use execshell.
Any suggestions?

Regards,


I would suggest trying this


ExecShell open `"$INSTDIR\mysql\bin\mysql"` `'databasename < $INSTDIR\mysql\bin\myfile.sql'`

but now that i think about it that probably isn't much different then what you used. could you just use the Exec command like

Exec `"$INSTDIR\mysql\bin\mysql" "databasename < $INSTDIR\mysql\bin\myfile.sql"`


well...i think ive tried all combinations. :confused:

Do you know why the code is working for php en apache and not for mysql?

regards,


Use this:


Exec '"$INSTDIR\mysql\bin\mysql" "databasename" < $INSTDIR\mysql\bin\myfile.sql'

-Justin


Hi Justin,

i tried your code. But its still seeing the whole commandline as the databasename instead of the first part of the line.

the .bat file im running looks like this:


Maybe ive to go to the bin dir and then execute this?

Exec `"mysql" "databasename < $INSTDIR\mysql\bin\myfile.sql"`

//Darktrain

Originally posted by Darktrain
Hi Justin,

Maybe ive to go to the bin dir and then execute this?

Exec `"mysql" "databasename < $INSTDIR\mysql\bin\myfile.sql"`

You've still got the syntax wrong. You don't want quotes around the parameters. Mysql will think the whole string is the database name.

You sure you haven't tried:
Exec '"$INSTDIR\mysql\bin\mysql" "databasename" <"$INSTIDR\mysql\bin\myfile.sql"'

yes, and it also isnt working.

Exec '"$INSTDIR\mysql\bin\mysql" "databasename"<"$INSTIDR\mysql\bin\myfile.sql"'


The last part of the commandline doesnt work with mysql(?).

Hi!

This code:

Exec '"$SYSDIR\command.com" /c echo asdasd > asd.txt'

seems to work. If it works for > it should work for < too.

KiCHiK

Hi DarkTrain,

ExpandEnvStrings $0 %COMSPEC%
Exec `"$0" /C "$INSTDIR\mysql\bin\mysql" "databasename" < "$INSTDIR\mysql\bin\myfile.sql"`
This piece of code should solve your problem. If it doesn't work, try modifying your myfile.sql file so that it loads databasename from it. Then, you would use:
ExpandEnvStrings $0 %COMSPEC%
Exec `"$0" /C "$INSTDIR\mysql\bin\mysql" < "$INSTDIR\mysql\bin\myfile.sql"`
You might prefer to use ExecWait. This means that a command interpreter is required for it to work properly. I would have thought someone would pick that up. :p

Yes, that piece of code solved my problem.

Thanks petersa,

//Darktrain