Javascript required
Skip to content Skip to sidebar Skip to footer

How to Install a Software Using Batch File

  1. Home
  2. Software
  3. 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


Popular Topics in Software Deployment & Patching

The help desk software for IT. Free.

Track users' IT needs, easily, and with only the features you need.

16 Replies

-Aldrin-
-Aldrin- This person is a Verified Professional
This person is a verified professional.
Verify your account to enable IT peers to see that you are a professional.
Sep 20, 2017 at 15:02 UTC

Deploying installers is easier and more manageable with GPO, provided you have .msi files instead of .exe.

JJoyner1985
JJoyner1985 This person is a Verified Professional
This person is a verified professional.
Verify your account to enable IT peers to see that you are a professional.
Sep 20, 2017 at 15:03 UTC

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.

BassistChris

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

Lioness

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.

JJoyner1985
JJoyner1985 This person is a Verified Professional
This person is a verified professional.
Verify your account to enable IT peers to see that you are a professional.
Sep 20, 2017 at 15:38 UTC

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.

Lioness

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

Jim4232
Jim4232 This person is a Verified Professional
This person is a verified professional.
Verify your account to enable IT peers to see that you are a professional.
Sep 20, 2017 at 16:30 UTC

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

JJoyner1985
JJoyner1985 This person is a Verified Professional
This person is a verified professional.
Verify your account to enable IT peers to see that you are a professional.
Sep 20, 2017 at 16:42 UTC

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                            
joseespitia
joseespitia This person is a Verified Professional
This person is a verified professional.
Verify your account to enable IT peers to see that you are a professional.
Sep 20, 2017 at 17:06 UTC

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                            
Lioness

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

joseespitia
joseespitia This person is a Verified Professional
This person is a verified professional.
Verify your account to enable IT peers to see that you are a professional.
Sep 22, 2017 at 17:49 UTC

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.

Lioness
Jim4232
Jim4232 This person is a Verified Professional
This person is a verified professional.
Verify your account to enable IT peers to see that you are a professional.
Sep 25, 2017 at 17:54 UTC

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

Lioness

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

Cilo-Psy_Tim

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-

msiexec /i C:\temp\slacksetup.msi /qn /norestart
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.

Peter (Action1)
Peter (Action1) This person is a Verified Professional
This person is a verified professional.
Verify your account to enable IT peers to see that you are a professional.
Nov 19, 2018 at 07:56 UTC

Brand Representative for Action1 RMM

I think you can use this script:

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.

Edited Nov 23, 2018 at 04:32 UTC

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