How to Install a Software Using Batch File
- Home
- Software
- Software Deployment & Patching
Hi,
I am trying to write a batch script to intall an .exe setup file. My scripting is not good, can anyone give me a helping hand or point me to a good source.
Thanks
The help desk software for IT. Free.
Track users' IT needs, easily, and with only the features you need.
16 Replies
Deploying installers is easier and more manageable with GPO, provided you have .msi files instead of .exe.
Installing programs that are based on an .exe installer can be tricky because there are a few different ways they interpret switches. For example, some will take /S for an unattended install while others take /quiet.
Probably the easiest way to handle this is if you tell us what .exe you are trying to install and how you want the batch file to handle the installation process. Are you wanting a silent install? Are you trying to pass installation options to the installer? Things like that.
-Aldrin- wrote:
Deploying installers is easier and more manageable with GPO, provided you have .msi files instead of .exe.
This. If there is an msi, GPO will take it all the way. If you only have an exe, then it depends on the program...
You'd have to set flags for options, install path, next, etc. If the software is from a large company, they may have these things published somewhere (or an .msi).
I've seen small or custom exe's that don't have any cmd line details available. This would be incredibly difficult to automate!
I am not in a domain environment, therefore no GPO. I am trying to install Slack onto a desktop as apart of a bunch of other scripts that run. I have the .msi file if that makes things easier.
Lioness wrote:
I am not in a domain environment, therefore no GPO. I am trying to install Slack onto a desktop as apart of a bunch of other scripts that run. I have the .msi file if that makes things easier.
MSI installers are ridiculously easy to use.
msiexec /i <path to msi> /qn /norestart
/qn = completely quiet
/qr = quiet, reduced UI
/qb = quiet, basic UI
Probably best just to call msiexec with /? to see all of the options.
I have tried this but it did not work. Does the path need to be the full path as in c:/folder/folder/slack.exe
Are you trying to install the .exe from a remote location like a server and install on a local machine? That one is pretty easy.
Here is a post from awhile back - https://community.spiceworks.com/topic/651047-batch-file-to-install-citrix
Lioness wrote:
I have tried this but it did not work. Does the path need to be the full path as in c:/folder/folder/slack.exe
Installing using msiexec only works for the msi installers. So, it would be something like:
msiexec /i C:\folder\folder\slack.msi /qr /norestart
Lioness wrote:
I have tried this but it did not work. Does the path need to be the full path as in c:/folder/folder/slack.exe
Download the Slack MSI and follow the instructions that were posted above.
https://get.slack.help/hc/en-us/articles/212475728-Deploy-Slack-via-Microsoft-Installer
msiexec /i "INSTALL.MSI" /qn /norestart
Thanks for your help so far. :)
Now I am getting: This installation package could not be opened. Contact the application vendor to verify this is a valid windows installer
I am running it as admin
Lioness wrote:
Thanks for your help so far. :)
Now I am getting: This installation package could not be opened. Contact the application vendor to verify this is a valid windows installer
I am running it as admin
Are you using an EXE or MSI? MSIEXEC only works with the MSI extensions.
Can you run the .msi on your machine with no errors? Is there input required from the user to install the program such as location, license agreement, etc.?
I can run it normally (by a double click) and it installs fine, but this script is not working. I have put it in the same folder with the msi file.
msiexec /i slacksetup.msi /qn /norestart
I know it's late, but I believe the issue was that you still didn't put in the directory path, it would have needed to be something like this-
If you put the slacksetup.msi in C:\temp.
You can simulate what is happening by just typing msiexec /i qwererere and the same error will popup, you do not seem to be directing it properly.
More often than not, you need to spell out the entire directory for commands such as this.
Brand Representative for Action1 RMM
start /w "" "%~dp0setup.exe" /s
%~dp0 => is replaced with the FULL PATH upon execution of batch.
/w => tells start to wait for exe to complete before moving on.
But if you want to do it simplier on multiple computers or if you're going to install EXE software remotely without GPO try to use our tool Action1.
This topic has been locked by an administrator and is no longer open for commenting.
To continue this discussion, please ask a new question.
How to Install a Software Using Batch File
Source: https://community.spiceworks.com/topic/2054435-batch-script-for-exe-install