Open File during Installation - nsis

I am using NSIS to create installer. Also I need to install other program (I have his installation file). How add second installer to automatically run it during first installation?

The simplest is to run the file (which must be first extracted to some directory,. e.g. $TEMP) with
ExecShell "open" "$INSTDIR\app.exe"
or with
ExecWait '"$INSTDIR\someprogram.exe"' $0
if you want to wait for program to finish.
Also consider many possibilities: whether the app should be run with some parameter, in Silent mode or elevated with admin rights or run as original user...

Related

How do I add "requires elevated privileges" to an existing EXE file? (Or can I set it when running IExpress?)

We have an installer for our application. (A C++ program, created in VisualStudio 2012.) The installer is now signed and require elevated privileges - the user gets a neat UAC question.
For some customers though, the installer needs a lot of other files. We use IExpress to create a self-extracting archive. The user runs the self-extracting EXE file, the files get unpacked and our installer starts.
But that doesn't work after we added UAC support. The EXE built by IExpress won't start a program that requires elevated privileges.
An easy solution would be that the EXE built by IExpress also requires elevated privileges. But I haven't found a flag to IExpress that does that. (Or did I miss something?)
Is there an easy way to add the "require elevated privileges" to an existing EXE file?
A fairly easy way to do it seems to be via cmd.exe. Just change your install program from, eg:
setup.exe
to
cmd /c setup.exe
Then the IExpress “magic UAC detection” won’t happen, and the user will get the standard UAC prompt when your program runs.
If you want to know more…
New versions of IExpress include a manifest which deliberately does not request UAC elevation for the IExpress-generated package itself. Here’s what it looks like in wextract.exe (the part that is actually bundled in your generated package):
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
According to MSDN, the asInvoker level means: The application will run with the same permissions as the process that started it.
Apparently there are some programs which can modify the manifest after-the-fact. One is called ResEdit, though I recommend that you download it from SoftPedia, as the .net site seems to carry some adware now. I didn’t have any luck with it (I think because I didn’t have Visual Studio installed) but maybe it will work for you.
If you decide to go this route, try to change the level to requireAdministrator.
you could try this in the post installation command of iexpress wizard:-
PowerShell -windowstyle hidden -command "Start-Process -Wait setup.exe -Verb Runas"
-windowstyle hidden hides the powershell window.
-Wait waits for the completion of setup.exe before deleting temp files(where iexpress files are extracted by default)
-Verb Runas Requests for elevation.
If you right click the installer exe file, go to Properties and click Compatibility then check the check box called Run this program as a administrator and click OK it should work.

How to set the whole installer invisible while using 'ExecWait' in NSIS?

I'm installing a program with my installer and run it with 'ExecWait'.
Is there a way to hide the window of the installer while the program is executed?
The installer should show up again and continue when the user quits the executed program.
Is there any way to achieve that?
HideWindow
ExecWait '"$InstDir\Foo.exe" "space bar" /baz'
BringToFront

Requiring specifying an instance when running a setup.exe from InstallShield

I develop/maintain an installer built with InstallShield that supports multiple instances. Due to various reasons we always recommend those who run our installer to use the /Instance switch that InstallShield's setup.exe bootstrapper has. Is it possible to get InstallShield to require that the /Instance switch is used? Or is there anyway to check if the setup.exe has been run without the /Instance switch?
If this is an Install Script installer, you can check the value of the command line parameter when the installer first starts. If the value of the command line parameter is not what you want, you can display a messagebox to the user and exit.
szCommandLine = CMDLINE;
if (szMasterCommandLine == "/instance") then
MessageBox("Hello! This installer is running in instance mode.", INFORMATION);
else
MessageBox("You must run this installer with the /instance command line parameter.", INFORMATION);
abort;
endif;

NSIS execwait will not launch any network located exe, using a variable (execwait '$PATHTOEXE' )

My code for a NSIS execwait will not launch any network located exe, using a variable (execwait '$PATHTOEXE') even though it contains the full path to the exe.
Yes, the variable contains the correct path and syntax for a path, along with the correct name of the exe. The user has full administrator (full control) rights to the folder/exe on the network.
The exe launches immediately when the execwait has the full path i.e. execwait 'P:\folder\folder\setup.exe'. It does not launch the app with execwait '$PATHTOEXE' - the best I've gotten on occasion is the msiexec command line msg box to pop up.
I've used a msg box to make sure the global variable contains the correct path (e.g. P:\folder\folder\setup.exe) which is identical to the typed path that works.
Yes I have tried adding double quotes '"$PATHTOEXE"'. I have tried adding the execwait 'msiexec /i $PATHTOEXE' with and without double quotes. I have tried making the variable just to the root directory and adding the setup.exe to the line (i.e. execwait '$PATHTOEXE\setup.exe') with and without double quotes. The particular setup.exe was created by install shield.
Anyone have an idea of what I may be doing wrong?
Try Process Monitor to see which path it tries to execute when it fails...

NSIS Silent Install changing default options

I have a third party application I would like to silent install from the command line.
The application is PPLive available at: http://www.pptv.com/en/
It is an NSIS installer, and currently when silently installed, installs toolbars, and additional pieces of software, launches on completion etc.
Without repackaging it, how do I control the checkbox options on the pages of the normal installer from the silent command line install.
Is it even possible?
NSIS supports the silent install option with the /S command line script, however, it only sets a flag that the install script can check:using IfSilent.
There is an example script here that demonstrated a silent installation.
You can't control the components unless the installer has been coded specifically for it (By using a "answer" file/.ini or some parameter you pass on the commandline) NSIS itself only allows the author of the installer to know if it is in silent mode or not, the rest is up to them. You would have to ask the PPLive people about it (Or request that they add it if they don't support it already)

Resources