Install software using command prompt start command with target directory - command-line

I am trying to install software using command prompt using below command
start /wait /d "C:\abc" C:\Users\abc.exe /silent /norestart
I want to install software in c:\abc folder but it is installing in the software default directory. Is there any way to install it into the custom directory using the start command or are there any other alternatives to install the software on the target directory.

SHORT VERSION:
This may be the most "accessible" and "quick" explanation for your particular case: http://unattended.sourceforge.net/installers.php
If you are dealing with an MSI file, you should use the admin install feature to extract all the installation files first and then customize your install by setting public properties or utilizing a transform to configure the install. Details here: How to make better use of MSI files.
See the link towards the bottom to find a list of different parameters you can use for different types of setup.exe files.
DETAILS:
A setup.exe file can be "anything". It can be an old, legacy Installshield or Wise installer, a modern Windows Installer file (MSI) embedded in a setup.exe launcher, an Inno setup file (non MSI), an embedded Advanced Installer MSI setup, a compressed and self-extracting zip file, a unique and custom made installer (proprietary), or any number of other technologies, the list goes on and on and on - it is impossible to tell what tool or technology was used to create your setup.exe from the information supplied.
Just for reference, let's link to installsite.org's information on different setup technologies and available tools. Most likely your setup.exe is made using one of these tools:
Non-MSI installer tools: http://www.installsite.org/pages/en/tt_nonmsi.htm
Windows installer tools: http://www.installsite.org/pages/en/msi/authoring.htm
This may also be of help: Wix - How to run/install application without UI.
The point is, naturally, that every, different technology has its own way to enable silent installation and to customize installation parameters. So the first step for you is to determine what this file really is. Right click the file, select properties and check the details tab for any clues. Or just run the setup.exe interactively and see what the window title is (top window title bar). It will generally indicate what tool was used to create the setup.exe.
Rather than rewriting it all, and since it is a stackoverflow link (unlikely to be removed), I will just link to a similar answer on how to install setup.exe files silently: How can I use powershell to run through an installer?. See the "some links" section for links to documentation for various tools.

Related

How to run an installation in /silent mode with adjusted settings

My goal:
I want to create a CMD command that will installs a program with adjusted install settings.
If I execute my .exe install file without any parameters, I have to click myself through the installation but I am able to change the install settings, like in which folder the setup will install the program or change the status of a checkbox.
However, I want to run the installation in /silent mode, in which I don't know how to change the install settings.
So the question is:
Is there anyway to give the shell a correct installation settings and then execute the file in silent mode?
I need this because I have to run the installation on multiple computers so it would be very comfortable if I had a script that runs the installation with correct settings.
Someone please guide.
Community: I'll elaborate later, but first let us do the easiest way. You could try to search for your software on sites dedicated to setup information and how to deploy various third party software silently:
https://www.itninja.com/software
Similar, terser answer: Silent run installer (.exe) with parameters on Windows
1) Standard Packaging Formats: If the setup.exe wraps a standard packaging format such as an MSI file, then you generally need to find a way to extract the package inside and customize its silent installation using standardized customization mechanisms involving command lines and MSI transforms.
2) Proprietary Packaging Formats: If the setup.exe is a proprietary format you need to either repackage it in a standard format (MSI) using tools to do so, or you need to run the installer in silent mode. The latter can be unreliable, but is often done for small scale distribution.
Look and Feel: Experience can teach you what tool was used to make the setup.exe by looking at the dialogs at runtime. Sometimes you see a company name or a tool name embedded in them.
So in summary:
Extract standard package if possible.
Customize standard package.
Repackage.
Install silently using original setup.exe.
Let's briefly describe these different tasks:
Extraction of Files:
There is a forest of tools that can create setup.exe files, it is impossible to cover all of them. They might feature all kinds of different command line switches. A setup.exe can even be totally proprietary, meaning no deployment tool was used to make it at all. It might have been compiled using Visual Studio for example.
A description of tools that can be used (non-MSI, MSI, admin-tools, multi-platform, etc...).
Common tools such as Inno Setup seem to make extraction hard (unofficial unpacker, not tried by me, run by virustotal). Whereas NSIS seems to use regular archives that standard archive software such as 7-Zip can open.
I try the following command lines to see if I can do a file extract:
setup.exe /a (Installshield MSI)
setup.exe /stage_only (Installshield Suite)
setup.exe /x (Wise, Advanced Installer)
setup.exe /extract_all (Installshield Installscript)
dark.exe -x outputfolder Setup.exe (WiX Burn Bundles - requires WiX toolkit installed)
Additionally some general tricks exist:
Launch the setup.exe and look in the system's temp folder for extracted files.
Another trick is to use 7-Zip, WinRAR, WinZip or similar archive tools to see if they can read the setup.exe format.
Some claim success by opening the setup.exe in Visual Studio. Not a technique I use.
The general approach for finding switches is to open a command prompt and go setup.exe /? or setup.exe /help or similar.
Also check for vendor online information and sites such as https://www.itninja.com/software.
A sprawling answer on this topic: Extract MSI from EXE.
If you manage to extract (or the file format is viewable as an archive), you can look for PDF, HTML, TXT or CHM files with further deployment info. Samples: ReadMe.txt, LSD.pdf, Large Scale Deployment.pdf, User Guide.chm, Manual.chm etc...
MSI - Customize Standard Package:
So, if the extract works and you extract an MSI file, then you can customize its installation in detail using standardized mechanisms. Make sure to look for the files with deployment information mentioned above - PDFs, CHMs, TXTs, etc... They could feature sample command lines for you to use more or less directly.
And crucially you could have extracted runtimes and prerequisites that also need to be deployed (.NET framework, Crystal Reports, Visual C++ Runtime, etc...). These are all managed and controlled on corporate networks and are not to be deployed with your package, but by their standardized packages.
Standardized customization mechanisms are great for corporate deployment, but require some MSI knowledge:
How to make better use of MSI files - a comprehensive description of MSI installation customization: with some sample command lines and description of the process.
A simplified view of MSI installation customization.
Here you can see that some setup.exe files can be installed directly in silent mode by passing in a command line using the /v parameter. These are Installshield MSI setups.
You can also see how the features in the MSI can be set at the command line.
A couple of concrete samples (extracted from links above):
Command Line Customization
msiexec.exe /i myinstaller.msi ADDLOCAL="Program,Dictionaries" SERIALKEY="1234-1234" /qn
ADDLOCAL specifies what features from the MSI to install (see feature sample screenshot here). The uppercase values such as SERIALKEY are PUBLIC properties that can be set on the command line. These vary from setup to setup. Look for documentation from vendor, check the Property table and check the setup dialogs.
Transform
msiexec.exe /i myinstaller.msi TRANSFORMS="mytransform.mst" /qn
The transform approach sets all the values needed inside a little file that is applied at installation time. It is called the transform. It is a little database fragment which is merged with the original MSI database at runtime.
Repackaging:
One way to create an MSI package from older-style, legacy setup.exe installers, is to "capture" the changes done to the system by using an Application Repackaging Tool which monitors changes made to the system whilst a setup.exe is being run.
This task may look easy, but it isn't. In fact it is very hard to clean up the resulting captures so you don't create "loose cannon" MSI files that cause problems on desktops throughout your organization. Corporations have dedicated teams to do this job and excellent MSI files can result that cause no problems when installed silently.
This task is not for the causal user in my opinion. It requires investment in the technology, expertise and time. Besides the tools available are pricey.
Silent Installation:
Most setup.exe files will at least attempt to install silently, though there are no guarantees. It is entirely possible that the setup.exe is impossible to install silently. I have seen it many times. In these cases repackaging is necessary, but even repackaging can fail at times. This is when it is time to push back on the vendor and ask them to get a grip about deployment. In a corporate world the software should be kicked head-first out of the application estate - if things work as they should.
Here is an old site dealing with the overall issue of silent installation of various setup.exe files: http://unattended.sourceforge.net/installers.php.
Here is a piece on silent uninstall which also describes silent running in general: Uninstall and Install App on my Computer silently
The general approach for finding such switches is to go setup.exe /? like you did. Often you can get a setup to install silently by trying something like this:
Visit https://www.itninja.com/software to check for switches from the community.
As stated above look for PDF, HTML, TXT or CHM files with further deployment info. Samples: ReadMe.txt, LSD.pdf, Large Scale Deployment.pdf, User Guide.chm, Manual.chm, etc...
Common: setup.exe /S, setup.exe /Q, setup.exe /quiet, setup.exe /VERYSILENT /NORESTART or similar.
Old-style Installshield setups need to have a response file recorded and then you install on all systems using the recorded dialog responses.
See this document.
Setup.exe /s /f1”c:\temp\my-answer-file.iss” /f2”c:\temp\my-log-file.iss”
Installshield Suites and regular Installshield setup.exe (links to Installshield's own help pages for setup.exe files)
Old Wise setups: https://www.itninja.com/blog/view/wise-setup-exe-switches
Some Links:
Create MSI from extracted setup files
MSI Deployment Tools List
Extract MSI from EXE
https://www.itninja.com/software
Uninstall and Install App on my Computer silently
Combine exe and msi file in one installer
How can I use powershell to run through an installer?
How to Install an NSIS Executable Silently For All Users

How can I use powershell to run through an installer?

I am trying to install a piece of software that when done manually has configuration options you can choose from when going through the process. I am trying to figure out a way to automate this using powershell but am stuck as to how I can set those configuration options. I believe I would need to run the start-process command on the installer .exe but I don't know where to go from there. Can I use the parameters on the start-process command to pass in the configurations I want?
UPDATE: Several links towards the bottom with information on how to handle installation, configuration and file extraction for setup.exe files.
UPDATE: See Windows Installer PowerShell Module on github.com (scroll down for description, use releases tab for download). I haven't really tested it much, but it is from Heath Stewart - Microsoft Senior Software Engineer (github).
I had a quick look for that installer, but didn't find it easily. Essentially the installer is either a Windows Installer database (MSI) or something else - generally a setup.exe of some kind. An MSI database can also be wrapped in a setup.exe.
You should be aware that for legacy style installers a common practice for large scale deployment is to capture the legacy install with an application repackager tool, and then compile an MSI file to use for installation (effectively converting an installer from an old format to modern MSI format). This is a specialist task requiring good understanding of Windows and setups. It is generally done in large corporations for very large software distributions. If you are in a large company there might be a team dedicated to packaging software like the one you mention. Maybe check with your management. If the setup is an MSI the same team can also modify that for you according to your specifications.
With regards to your installer EXE. Try to run setup.exe /a from the command line and see if you get an option to extract files to a "network install point" (administrative install). Then you are dealing with an MSI file wrapped in a setup.exe. If that doesn't work you can try setup.exe /x or setup.exe /extract as well.
Windows Installer has built-in features to allow you to customize the install via PUBLIC properties (uppercase) set at the command line or applied via a transform (Windows Installer's mechanism to apply substantial changes to the vendor file - it is a partial database that gets applied to the installation database from the vendor at runtime).
Non-MSI, legacy installer technologies generally have fewer reliable ways to customize the installation settings, and they tend to be rather ad hoc when they are there. In particular the silent running and uninstall may be features that are missing or poorly executed. These installs are generally all wrapped in EXE format, and there are many tools used to generate them - each with their own quirks and features.
In other words, it all depends on what the installer is implemented as. Give that setup.exe /a a go, and update your answer with new information for us (don't add too many comments - we will check back).
With regards to using PowerShell. I haven't used PowerShell for deployment so far to be perfectly honest. Here is a basic description of how to install using PowerShell: https://kevinmarquette.github.io/2016-10-21-powershell-installing-msi-files/
You can also invoke automation for MSI files from PowerShell, I don't think this is relevant for what you asked, but here is a quick link for modifying a transform file: http://www.itninja.com/question/ps-how-to-edit-a-mst-file.
The normal way to install MSI files is via Window's built-in msiexec.exe command line. The basic msiexec.exe command line to install software is:
msiexec.exe /I "C:\Your.msi" /QN /L*V "C:\msilog.log" TRANSFORMS="C:\1031.mst;C:\My.mst"
Quick Parameter Explanation:
/I = run install sequence
/QN = run completely silently
/L*V "C:\msilog.log" = verbose logging
TRANSFORMS="C:\1031.mst;C:\My.mst" = Apply transforms 1031.mst and My.mst (see below).
What is a transform? Explained here: How to make better use of MSI files.
Advanced Installer has a general page on msiexec.exe command lines. And here is Microsoft's msiexec.exe documentation on MSDN.
Some links:
Perhaps see Michael Urman's answer here: Programmatically extract contents of InstallShield setup.exe. This is for Installshield packaged EXE files only.
Installshield setup.exe commands (general reference with some sample command lines - towards the end of the document it looks like the command lines are not correct, but the first ones look ok. The later ones are pretty obscure anyway - just thought I'd let you know since I link to it). Here is the official Installshield help documentation.
Wise setup.exe commands - Wise is no longer available, but if the setup is older it can still be packaged with Wise.
Advanced Installer standard command line. For this tool setups can apparently be extracted with setup.exe /x or setup.exe /extract. See the link for full list.
There was also a "silent switch finder" tool used to find hidden switches in exe files (for deployment), but it failed a virustotal.com scan so I won't link to it. Maybe it is using something exotic, such as scanning a file's header at a bit level or something weird that is flagged as malware by mistake? Either way, not a tool I would use.
And finally: http://unattended.sourceforge.net/installers.php. This link isn't bad, it presents some of the tools above and a few others - and the most common switches used. Untested by me, but looks ok.
And there are other deployment tools that have their own way of packaging and delivering EXE files - it can be a jungle. I can provide a list of such tools with more links, but maybe that's just confusing. Please try what is provided above first.
Here is a generic answer that might be helpful as well: Extract MSI from EXE

How do I add VSCode to the PATH for PowerShell?

The Code documentation suggests that it is added to the PATH during installation, but that did not seem to work for me (at least not in PowerShell). Where is it installed such that I can add it myself?
The install path is C:\Users\username\AppData\Local\Code
C:\Users\username\AppData\Local\Code\bin is added to the PATH by the installer, but it might be that tools such as PowerShell will pick this change up only until after a log off/log on or a restart
On macOS, VS Code these days seems to have a Command Palette (shift + Cmd + P) command to install it to the path called "Shell Command: Install 'code' command in PATH".
It seems that a good old restart of the box fixed the issue. Interestingly, merely restarting PowerShell or logging out and back in didn't fix it.
Modern Software Installation.
Many of the larger software packages have finally caught-up with the times. Make sure the correct choice(s) are made during the software download and during the software installation.
Most individual PC users are the sole users of their PCs. Yet many software packages have always defaulted the installation processes to assume otherwise. This is why so many software packages install to a path that includes C:\ .... user\ ...
But most of us individual PC users don't want the software installation including a path that involves using the ... user\ ... path. And instead we want the software installed into the default C:\ path without the "user name".
Some of the most common software installation packages are becoming available for the individual PC user and these packages install on the PC in our preferred path - (not involving a path through the ... user\ ... ).
And if there is not a separate download package for the individual PC user, then during installation make sure to closely read each step which will often now include a checkbox of whether the installation is for a "user" or for "all users". Select all users.

Packaging application

We have a windows app and we were using Wise for deployment. Recently we switched to InstallAware and though it has some good points we are facing some issues. Can someone recommend another deployment and packaging app? We are a small company and we do not have a dedicated staff for packaging etc. Also our package includes SQL server express installation and we would love to have the simplicity of such includes as is in IA.
How about NSIS or InnoSetup? They're both widely used, and not that hard to use. (If you choose InnoSetup, also download ISTool, it's a lot easier than writing the script file manually.)
We've used NSIS several times, both for full regular desktop installers, and for small, silently installing patches. It's easy to write a basic installer, especially if you use HM NIS Edit which acts as a wizard and IDE for NSIS. Because it's scriptable, you'll be able to check if SQL Server Express is already installed - if not, it can be installed as part of your installer process.
I have never used anything but Windows Setup and the setup projects that come with Visual Studio. Do you have any unusual requirements that prevent you from doing that?
I assume your requirement as follows,
You are using wise package studio to create\customize the application to create MSI and these msi package will be deployed or installed to your environment.
My question is : How many desktops \laptops are their in your company (Infrastructure)
Solution to your question based on my assumption:
At present Admistudio is the best product to replace the Wise and you can use Installshield repackager to create or customize the applications.
Install anyware is used to customize the Dll files (Build and release method) and create custom actions in that build file and build it to MSI
Installshield Repackager is used to create MSI from Exe files and also customize existing MSI using transform file (no need to modify existing MSI instead we can create MST file to MSI and perform the customization to MST file and same file will be applied while deployment.)
Please let me know if you need further assistance.

Why do so many programs have both a setup.exe and a setup.msi?

I have always wondered about this. So many application setups have a zip file that you unzip, and in it are a bunch of files, among other things an exe and an msi. What is the difference? They are often even about the same size. I am never really sure which one to execute, sometimes I do the exe and sometimes the msi, and it usually works with either one. But does one of them do anything that the other doesn't do? And if not, isn't it kind of a waste having two files that does the same thing? Especially when thinking about download size, etc...
Not sure if this should be here or on ServerFault, or maybe neither, but I figured since developers usually are the ones creating setup files, then developers might know why this is like it is =)
In the case where you have both exe and the msi the exe is just a loader for the msi. If you have an installation supporting multiple languages then the exe applies a language transform (mst) on the msi before installing.
You can consider the exe as a wrapper around the msi. The msi file may or may not be given separately. The reason why people give the msi file too is to facilitate a group policy installation (in a Windows Active Directory infrastructure) as you can only push down installations of msi files and not exes.
The setup.exe is a wrapper for the MSI, but it is not only a wrapper.
The setup.exe can rely on a setup.ini to define parameters
The setup.exe checks for the Windows Installer (a MSI cannot be installed otherwise)
The setup.exe can check for frameworks, like the .NET framework. The developer can pick one of those defined in C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages (for Visual Studio 2008). If it is lacking, it will try to download it from http://www.microsoft.com/
The setup.exe can be reconfigured with msistuff.exe
The actual installation is done in the MSI. As Prashast said, the exe is just a wrapper, but the reason for having the exe, is that an exe is allways possible to run. If the user do not have MS Installer installed on the computer, or his version of MS Installer is older than the version required by your installation, then the MSI file is not possible to run.
The exe provides automatic installation of MS Installer (including some question to the user if he/she wants to do this) before running the MSI file. In most cases, the install packages needed for Microsoft Installer is included inside the setup.exe, or sometimes it is just the prerequisites check with a link to download the installation from Microsoft.
In very basic words,
you can deliver just the .msi file and it will install. but .exe will not work without the .msi