[Bat] How to make a batch to install multiple msu!Let's apply the updates all at once.


This time I would like to make a batch that installs the .msu extension file, which is common in Windows updates.
That alone is not a trick, so I would like to try installing multiple msu files collected in one place in a folder at once.

Basic information and installation commands

First, download the msu file, which you can download from the Windows Update Catalog.In an environment where automatic updates are turned off due to factors such as the application not working if a specific KB is included, there are many cases where you select and download the update program yourself.

Microsoft®Update Catalog


The downloaded msu file can be installed manually by double-clicking or by executing it from the command line, as described in the following Microsoft document.

About Windows Update Standalone Installer for Windows


However, if this is left as it is, the installer will start and some mouse operation will be required.
It's not so much if it's about one, but it's a hassle when setting up many.
So, first of all, I would like to make a silent installation that does not require any operation.

Sample command

% USERPROFILE% \ Desktop \Windows6.0-KB934307-x86.msu -quiet -norestart

Run this timePlaced on the user's desktopI will try it on the premise.

In this way, add [-quiet] and [-no restart] as options.
[-quiet] Literally installs quietly.The installation is completed without any operation on the user side without displaying any dialogs.However, if the prerequisites are not met, such as when there is a prerequisite KB, it will fail.

[-norestart] Suppresses a reboot.
If [-quiet] is specified and the installation requires a reboot, the reboot will start without permission.This is useful when there are several updates or when there are files that you are working on and have not saved.You will need to manually reboot when you are done.

As a result, it is not displayed at all and can be installed without any operation.

* Since the msu file is associated with Wusa.exe by default, it will work even if it is executed directly as it is, so it is omitted.

Install multiple msu files at once

Combine the above command with the "For" and "Dir" commands to install all the msu files in the same folder as the batch file at once.

@ Echo off
cd / d% ~ dp0

for / f %% a in ('dir /b *. msu') do (do (
echo %% a installing
call %% a / quiet / norestart


I won't explain in detail here, but "dir /b *. msuIs reading a file with all msu extensions.

afterwards, "for / f %% a in ('dir / b * .msu') By doing so, for reads the result of Dir line by line,do ()It is the content to execute inside.

In this case, "for" will install the list of msu files read by "dir" one by one.

* "Cd / d% ~ dp0" means to move to the same path as the location of the batch file. (Move current folder)

In this case, all msu files in the same folder as the batch file will be installed.


That's all for installing the msu files all at once.
With this method, you can combine the necessary updates into one folder, then throw the above batch file into the same folder and execute it, and all you have to do is wait.

As a trick, Dir lists alphanumeric characters in ascending order.
Therefore, you can control the installation order by adding the number you want to execute to the msu file.If you have a prerequisite KB, you should rename it.


Windows6.0-KB934307-x86.msu → 1.Windows6.0-KB934307-x86.msu

Also, there is a similar update file that is distributed as an exe file to the KB for Office.
You can also operate it in the same way by rewriting the * .msu part to * .exe.


for / f %% a in ('dir / b * .msu') do (
echo %% a installing
call %% a / quiet / norestart


for / f %% a in ('dir / b * .exe') do (
echo %% a installing
call %% a / quiet / norestart

I often do clean installs, but I often use this batch because I find these two patterns of KB installs cumbersome.

I hope it helps you.


  1. […] [Bat] How to make a batch to install multiple msu This time, Windows Update Pro… […]

Translate »
I copied the title and URL