Batch file for automatic installation of multiple programs

I want to create a batch file that will install multiple programs in sequence. I can install the required software sequentially using the following code in a batch file:

@echo off
"Path/software1.exe"
"Path/software2.exe"
"Path/software3.exe"
"Path/software4.exe"

      

OR

@echo off
start /wait "Path/software1.exe"
start /wait "Path/software2.exe"
start /wait "Path/software3.exe"
start /wait "Path/software4.exe"

      

But before installing any software, I want to check if it is installed or not.

I tried to get a list of installed programs using the following two methods:

wmic product get name

      

OR

reg export HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall temp.txt /y

      

But then I will have to search for lines, which is not possible. Thus, I would like to know if they have any command to check if a particular application is installed or not using a batch file? Thanks in advance.

+3


source to share


3 answers


There is no official way to check if the app is installed. Installers, for the most part, just copy files, install registry keys, and add start menu shortcuts, without registering anything with Windows to say I'm installed.

A common way to check if an app is installed is to see if it has an entry in the Add / Remove Programs applet in Control Panel. Each ARP entry is located in the registry at: Software\Microsoft\Windows\CurrentVersion\Uninstall

(both HKEY_CURERNT_USER and HKEY_LOCAL_MACHINE)



If it is an MSI based installer, you can probably write code to see if a Function ID or Component ID is set with the MSI API . I don’t know how to call these functions in a BAT file without compiling some helper programs.

+1


source


you just accept the terms

if does not exist "C: \ Program Files \ software1"
"Path / software1.exe"

if does not exist "C: \ Program Files \ software2"
"Path / software2.exe"



if does not exist "C: \ Program Files \ software3"
"Path / software3.exe"

if does not exist "C: \ Program Files \ software4"
"Path / software4.exe"

0


source


It might help (which I am using to show the installed software after the completed package) to put "appwiz.cpl" without quotes at the end of your script.

example:

@echo off
C:\WINDOWS\system32>
cd C:/ (assuming files are located here)
echo You are about to install software1,2,3, press ENTER to proceed...
pause
"path\software1.exe"
"path\software2.exe"
"path\software3.exe"
appwiz.cpl

      

0


source







All Articles