Archive: Exec executes in one PC and not in another


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


Try using ExecShell with the open command.


Thanxs, but it also doesn't work :cry: any ideas other ideas???

cheers,
alej


If it helps, this is my command:

ExecShell open "$PROGRAMFILES\MyFolder\temp\myProgram.cmd" SW_SHOWNORMAL


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 :))


So complicated??? I just want to run a batch file, there's no way to use 'Exec'? But it works in my lap-top.


Try

System::Call "kernel32.lib::AllocConsole()"

first :-)


sorry, kernel32.dll


I am a bit lost with that expression, I am new to NSIS :-[
could you please tell me what it does? Thnaxs!


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.


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.


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.


no improvement! :-[


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?


It runs as Administrator!


It is probably a system related problem not related to this command.


ufff, then its not possible to run this batch file any other way?


Does the batch file work when you start it manually?


yes, in both machines.


Try to put quotes around the path:

'"file"'


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


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.


nothing! doesn't work....


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:!


Does that folder exist?


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