Get the App
SLTechnology News&Howtos  ›  Servers  › 

Quiet installation of patches in windows system

Shulou Source: shulou.com Published: 2022-06-02 19:06:57 10月03日 Update

Purpose: you can automatically install system patches in batches.

Environment: window 7

The script is as follows:

@ echo Off title Install Windows Update pack echo is being installed. Please wait a moment. :: loop all exe files in the current directory and install for% I in (* .exe) do% I / passive / norestart / nobackup:: loop all msu in the current directory, and install for% f in (* .msu) do start / wait wusa% f / quiet / norestart

Understand:

Mainly, the for loop returns the parameters of the current directory and then executes. Here / quiet does not ask mode, / norestart does not restart. For patch files, this script was originally used to install patches quietly, and / passive is executed sequentially. , / nobackup is not backed up.

If you need to restart automatically after installing all the patches, you can add shutdown-r-t 20 at the end

If you are worried about going wrong, here is a safe way to do it:

1) put the patch files in the same directory

2) navigate to this directory in cmd and execute dir / b > a.txt

3) A list of all the files in the current directory will be generated in the a.txt file. Select a file name from each type and use /? in the cmd. Query its parameters, and then write the required parameters to the end of the corresponding file in the list

4) delete the a.txt line in the list and change the a.txt file name to a.bat execution.

This method is slow, but proper (pay attention to the spaces in each position).

Tags: Files directories patches parameters loops file names scripts systems proper quiet secure useful location method original backup method end mode Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Apple Redmi Shulou Technology Microsoft