- NSIS Discussion
- ExecShell doesn't work in all computers
Archive: ExecShell doesn't work in all computers
mabrev
3rd June 2004 07:19 UTC
ExecShell doesn't work in all computers
Hi! I'm newbie with NSIS and my problem is that my instalation file works fine in my computer, but it doesn't work in another computers. The problem is in the ExecShell instruction, I try to execute a batch file that is ignored in other computers. Could anybody help me?
I've tried nsExec::Exec but this instrcution is ignored in my computer too.
Thanks in advance and excuse my poor english.
Davion
3rd June 2004 07:45 UTC
I don't know for what you use the batch file, but maybe
Exec or ExecWait could do the job
mabrev
3rd June 2004 08:12 UTC
No, I can't use Exec or ExecWait. I'm using the batch file for running this command: "mysql-opt -standalone", if I use Exec it appears a black screen that I want to eliminate using ExecShell.
Davion
3rd June 2004 08:16 UTC
is the Batch file not executet or does it only not work correctly on the other systems...maybe on other sys your command can't be understand properly
mabrev
3rd June 2004 08:20 UTC
If I use the same batch file with Exec sentence, the batch works in all computers but a black screen is shown, so the problem isn't the batch file or the command, it must be the ExecShell.
zimsms
3rd June 2004 15:23 UTC
Why not use nsExec?
nsExec
------
nsExec will execute command-line based programs and capture the output
without opening a dos box.
Usage
-----
nsExec::Exec [/TIMEOUT=x] path
-or-
nsExec::ExecToLog [/TIMEOUT=x] path
-or-
nsExec::ExecToStack [/TIMEOUT=x] path
See the documentation, it's all in there.....
mabrev
3rd June 2004 15:47 UTC
Originally posted by zimsms
[B]Why not use nsExec?
I've tried this also, but it doesn't work. I don't know why, but it doesn't do anything. I've seen the documentation, but I don't know if I have to add some code for using it or what it's wrong.
My code is:
SetOutPath $4\mysql\bin
File "mysql.bat"
; Exec 'mysql.bat' ;-- Se arranca el servidor Mysql
ExecShell "open" /S '$4\mysql\bin\mysql.bat' ;-- Se arranca el servidor Mysql
; nsExec::Exec "mysql.bat"
nsExec doesn't work in any computer, exec works in all and execShell only in my computer.
Somebody could tell me if there is something wrong?
zimsms
3rd June 2004 15:52 UTC
oh, nsExec works, but since NSIS is a win32 application no matter what you get the prompt back instantly. If you check your process viewer, you will notice your batch file is running.
I had a similar issue, and had to write a C function that waits for the process to end before returning to the user. I also requested that this functionality be added to nsExec, as nsExec::ExecWait. But have not seen it appear in CVS as of yet.
You can read the thread here.
mabrev
3rd June 2004 16:13 UTC
Well, I've checked my process viewer and my problem is opposite to yours, my instalation file is stopped waitting batch file ending. I want to nsExec doesn't wait, how can I do that??
zimsms
3rd June 2004 16:20 UTC
nsExec::Exec "$4\mysql\bin\mysql.bat"
Takhir
3rd June 2004 16:35 UTC
What about this?
System::Call 'kernel32.dll::WinExec(t "mysql.bat", i 0) i.r0'
Joost Verburg
3rd June 2004 16:48 UTC
Is the file associated set correctly?
mabrev
3rd June 2004 16:58 UTC
Originally posted by Takhir
What about this?
System::Call 'kernel32.dll::WinExec(t "mysql.bat", i 0) i.r0'
It works perfectly
Thanks a lot to everybody
ccartier
12th November 2007 09:41 UTC
System::Call 'kernel32.dll::WinExec(t "c:\temp\mybat.bat", i 0) i.r0' works well to launch a .bat file at the end of the NSIS installation process. Problem: WinExec executes the .bat file from ...\My documents (ie it's there I find .log file after the launch), whereas I'd like to be executed from the .bat repository, ie c:\temp (so as to read a .conf file).
Is there a way for it? I tried to precede "System::Call ..." with SetOutPath "c:\temp" but this doesn help...
I'll appreciate any comments
Cyril
Afrow UK
12th November 2007 10:56 UTC
If you need to run the batch file without waiting for it to finish and you cannot get Winexec working, you can make another NSIS executable that runs the batch file itself with nsExec and extract and run that at the end of your main installer with Exec.
The secondary installer code would look like this:
OutFile RunBatch.exe
SilentInstall silent
Section
nsExec::Exec ...
SectionEnd
Stu