- NSIS Discussion
- Exec executes in one PC and not in another
Archive: Exec executes in one PC and not in another
almoes
21st April 2004 08:34 UTC
Exec executes in one PC and not in another
Hi,
I am using the Exec command to run a .cmd file. If I run the script in a winXP client it runs, but if I try to execute it on a win2k server it doesn't work. But it doesn't give any error, that is, for the details of the installation it appears as executed. However I know the script doesn't even start because it generates a log file which is not generated. Any ideas? Thanxs!
cheers,
alej
Joost Verburg
21st April 2004 09:50 UTC
Try using ExecShell with the open command.
almoes
21st April 2004 10:38 UTC
Thanxs, but it also doesn't work :cry: any ideas other ideas???
cheers,
alej
almoes
21st April 2004 12:30 UTC
If it helps, this is my command:
ExecShell open "$PROGRAMFILES\MyFolder\temp\myProgram.cmd" SW_SHOWNORMAL
Takhir
21st April 2004 12:38 UTC
If ".cmd" (?) file requires console, try to use AllocConsole() API call in your NSIS script. Correct input/output redirection may be found in MSDN articles (CreatePipe(), DuplicateHandle(), CreateProcess()), but this is not easy way for script. And if this is what you need - ".cmd" text may help to understand problem :))
almoes
21st April 2004 12:43 UTC
So complicated??? I just want to run a batch file, there's no way to use 'Exec'? But it works in my lap-top.
Takhir
21st April 2004 12:49 UTC
Try
System::Call "kernel32.lib::AllocConsole()"
first :-)
Takhir
21st April 2004 12:52 UTC
sorry, kernel32.dll
almoes
21st April 2004 12:55 UTC
I am a bit lost with that expression, I am new to NSIS :-[
could you please tell me what it does? Thnaxs!
Takhir
21st April 2004 13:06 UTC
This allocates console for parent application, and child application gets correct i/o handles. But My explanation is not based on any facts - give me your script and I'll run it on my W2K Server.
almoes
21st April 2004 13:12 UTC
But how should I use the expression, I mean how do I indicate my batch file? My batch file gives some SQL commands, so you can't really execute it, but you can just do any batch file with an 'echo' to try.
Takhir
21st April 2004 13:19 UTC
System::Call "kernel32.lib::AllocConsole()"
ExecShell open "$PROGRAMFILES\MyFolder\temp\myProgram.cmd" SW_SHOWNORMAL
First call just creates conditions for next console app. execution. But (again) - there may absolutely another reasons of you batch crash, for example shell script specifics on various platforms.
almoes
21st April 2004 13:33 UTC
no improvement! :-[
zimsms
21st April 2004 13:46 UTC
It could be a permissions issue. Windows Server is very strict on who can install or execute scripting files. This batch file, you say it contains SQL which you are executing, do you have the correct permissions to access the SQL Server/Oracle Server etc?
almoes
21st April 2004 13:50 UTC
It runs as Administrator!
Joost Verburg
21st April 2004 13:50 UTC
It is probably a system related problem not related to this command.
almoes
21st April 2004 13:53 UTC
ufff, then its not possible to run this batch file any other way?
Joost Verburg
21st April 2004 13:55 UTC
Does the batch file work when you start it manually?
almoes
21st April 2004 13:56 UTC
yes, in both machines.
Joost Verburg
21st April 2004 14:03 UTC
Try to put quotes around the path:
'"file"'
almoes
21st April 2004 14:04 UTC
I got it....the script in the batch is failing (I entered a pause), but I dont know why because manually it runs. But its not NSIS problem anymore. So it looks like Exec runs on this system ;-) Thanxs for all.
cheers,
alej
zimsms
21st April 2004 14:13 UTC
You could try the following.
Admin Tools
Local Secuity Policies
User Rights Assignment
and add the admin to either of the following:
log on as batch job, or Act as part of the OS.
I'd only try this, it would at least let you know if it's a permissions thing. I found odd behaviour like this since I found the shell I was opening was just a shell with no privileges.
almoes
21st April 2004 14:36 UTC
nothing! doesn't work....
almoes
21st April 2004 15:41 UTC
I know whats going on, but still need some help. The ShellExec is not getting the proper path. If I do
SetOutPath $PROGRAMFILES\MyFolder\temp
on a XP client and a win2k client the path remains, but in the server it points to c:!
Joost Verburg
21st April 2004 16:31 UTC
Does that folder exist?
almoes
21st April 2004 16:34 UTC
Yes it exists and I checked tones of times the spelling of it. Anyway I tested in another win2k server and works fine. I really wonder what environment thing is different. Anyway, programming a 'cd path' in the batch file it works. Just to let say that there's something that doesn't always behave the same for 'SetOutPath'.