Archive: exec command questions


exec command questions
  Hi

i want to run a programm minimized.
exec seems not to support this. At th moment i have to create a batch file using the "start" command. This also is capable of setting process priority. Is there any way doing this with native nsis commands?


Use this:


ExecShell "open" "***91;exename***93;" "***91;parameters***93;" SW_SHOWMINIMIZED 

>
Where [exename] is the name of your .exe file and [parameters] are the parameters for it. If it doesn't work with "open", try something else (I'm not sure if "open" also works with executables).

Here you can find the syntax.

I've tested execshell with "open" but the programm didn't start


Try an empty zero-length string "". Everywhere I look, it says that in order to run a program, you must use an empty string. I can't test it right now.


This don't work either. Unfortunately ".exe" doesn't appear in the extension association in the explorer settings. Therefore i think it can only be "executed". But then there should be a way to change the status Maximized, normal or minimized like in shortcuts


I know. I didn't find it there eighter. But in Visual Basic, there is a very similar API command called ShellExecute. That does virtually the same and works the same.

I found some more information about this function here, and it states that you can use the "open" action for documents, files and executables.

Please post your code here, or at least the error you get, and where. Do you get the error when compiling the script, or when you run the script, or doesn't the exe start at all, without any messages?


mmh I didn't checked the state of errors yet but i can say that the script compiles without error but it seems that the exe wasn't executed but i will use the iferrors for testing purposes but i check for his later


i've checked again on another XP maschine the following

ExecShell "" "[exename]" SW_SHOWMINIMIZED

The Programm was started but not minimized


I think you should ask KiCHiK, for example, by PM-ing him: Click here!.


Does it work without SW_SHOWMINIMIZED?
Are you using a full path (F:\bla\bla\prog.exe instead of prog.exe)?


i'm using

ExecShell "" "$EXEDIR\exename" SW_SHOWMINIMIZED

and as i said the program starts but not minimized


Originally posted by JaqDraco
i'm using

ExecShell "" "$EXEDIR\exename" SW_SHOWMINIMIZED

and as i said the program starts but not minimized
ExecShell "open" "$EXEDIR\exename" "" SW_SHOWMINIMIZED

You didn't pass the empty paramater string in that example.

Originally posted by rainwater

You didn't pass the empty paramater string in that example.
is it necessary? Because the Compiler doesn't complains about the removal of the empty parameter string but i can check that later

The compiler cannot guess that SW_SHOWMINIMIZED is the fourth parameter when you type it as being the third.


this works:

ExecShell "" "$EXEDIR\exename.exe" "" SW_SHOWMINIMIZED

but the docs don't say that empty parameter is necessary to use the state

nevertheless is was my fault

sorry guys


That's because the writers of the docs are experienced C++, NSIS, Java, VB programmer's that forget things that are very normal and common for them, like knowing that you always have to fill in a parameter even when it's not used.

I deal with it all the time myself. I help people with Windows computer problems via the phone or e-mail and forget that very basic things like knowing how to open the context menu of a file or browsing for a folder are not known with those users.


I don't know how to describe it any better. When the 5th parameter is required, obviously you can't pass it as the 4th parameter.