Archive: ExecShell doesn't work in all computers


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.


I don't know for what you use the batch file, but maybe
Exec or ExecWait could do the job


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.


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


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.


Two links from 2-nd forum page :)

http://forums.winamp.com/showthread....hreadid=179975
http://forums.winamp.com/showthread....hreadid=181442

Try SW_HIDE first


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.....


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?

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.


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??


nsExec::Exec "$4\mysql\bin\mysql.bat"


What about this?

System::Call 'kernel32.dll::WinExec(t "mysql.bat", i 0) i.r0'


Is the file associated set correctly?


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

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


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