Old 3rd June 2004, 06:19   #1
mabrev
Junior Member
 
Join Date: Jun 2004
Posts: 6
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.
mabrev is offline   Reply With Quote
Old 3rd June 2004, 06:45   #2
Davion
Senior Member
 
Join Date: Apr 2004
Location: Nuremberg, Germany
Posts: 130
Send a message via Yahoo to Davion
I don't know for what you use the batch file, but maybe
Exec or ExecWait could do the job
Davion is offline   Reply With Quote
Old 3rd June 2004, 07:12   #3
mabrev
Junior Member
 
Join Date: Jun 2004
Posts: 6
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.
mabrev is offline   Reply With Quote
Old 3rd June 2004, 07:16   #4
Davion
Senior Member
 
Join Date: Apr 2004
Location: Nuremberg, Germany
Posts: 130
Send a message via Yahoo to Davion
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
Davion is offline   Reply With Quote
Old 3rd June 2004, 07:20   #5
mabrev
Junior Member
 
Join Date: Jun 2004
Posts: 6
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.
mabrev is offline   Reply With Quote
Old 3rd June 2004, 12:18   #6
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
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
Takhir is offline   Reply With Quote
Old 3rd June 2004, 14:23   #7
zimsms
Senior Member
 
zimsms's Avatar
 
Join Date: Jan 2004
Location: London, Ontario, Canada
Posts: 272
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.....
zimsms is offline   Reply With Quote
Old 3rd June 2004, 14:47   #8
mabrev
Junior Member
 
Join Date: Jun 2004
Posts: 6
Quote:
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:
code:

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?
mabrev is offline   Reply With Quote
Old 3rd June 2004, 14:52   #9
zimsms
Senior Member
 
zimsms's Avatar
 
Join Date: Jan 2004
Location: London, Ontario, Canada
Posts: 272
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.
zimsms is offline   Reply With Quote
Old 3rd June 2004, 15:13   #10
mabrev
Junior Member
 
Join Date: Jun 2004
Posts: 6
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??
mabrev is offline   Reply With Quote
Old 3rd June 2004, 15:20   #11
zimsms
Senior Member
 
zimsms's Avatar
 
Join Date: Jan 2004
Location: London, Ontario, Canada
Posts: 272
nsExec::Exec "$4\mysql\bin\mysql.bat"
zimsms is offline   Reply With Quote
Old 3rd June 2004, 15:35   #12
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
What about this?

System::Call 'kernel32.dll::WinExec(t "mysql.bat", i 0) i.r0'
Takhir is offline   Reply With Quote
Old 3rd June 2004, 15:48   #13
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
Is the file associated set correctly?
Joost Verburg is offline   Reply With Quote
Old 3rd June 2004, 15:58   #14
mabrev
Junior Member
 
Join Date: Jun 2004
Posts: 6
Quote:
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
mabrev is offline   Reply With Quote
Old 12th November 2007, 08:41   #15
ccartier
Junior Member
 
Join Date: Nov 2007
Location: paris
Posts: 8
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
ccartier is offline   Reply With Quote
Old 12th November 2007, 09:56   #16
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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:
code:
OutFile RunBatch.exe
SilentInstall silent
Section
nsExec::Exec ...
SectionEnd


Stu
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump