- NSIS Discussion
- execshell problem
Archive: execshell problem
Darktrain
4th January 2002 08:37 UTC
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,
Schultz
4th January 2002 11:41 UTC
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"`
Darktrain
7th January 2002 15:59 UTC
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,
justin
7th January 2002 22:39 UTC
Use this:
Exec '"$INSTDIR\mysql\bin\mysql" "databasename" < $INSTDIR\mysql\bin\myfile.sql'
-Justin
Darktrain
8th January 2002 09:27 UTC
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:
- cd mysql
- cd bin
- mysql databasename < "path\myfile.sql"
Maybe ive to go to the bin dir and then execute this?
Exec `"mysql" "databasename < $INSTDIR\mysql\bin\myfile.sql"`
//Darktrain
rainwater
8th January 2002 13:29 UTC
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"'
Darktrain
9th January 2002 09:54 UTC
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(?).
kichik
9th January 2002 14:32 UTC
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
petersa
9th January 2002 14:41 UTC
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.
- DarkTrain stated that his command line worked with a batch file.
- The command line contains '< filename', meaning 'use filename as the input device'.
This means that a command interpreter is required for it to work properly. I would have thought someone would pick that up. :p
Darktrain
10th January 2002 08:51 UTC
Yes, that piece of code solved my problem.
Thanks petersa,
//Darktrain