In-depth analysis of Win 2003 automatic upgrade patch function

  
            

Some readers have reported a problem with using the batch Windows Auto Upgrade file. Some patch packages have an error message during installation and cannot be continued.

After research, it was found that this is because Windows mainly has two different types of patches, which need to use different parameters. Once the parameters are wrong, it will not be installed, so different parameters are required for different patches. Let's analyze it in detail.

See the patch type from the picture

As shown in Figure 1, put the Windows 2003 Server patch file in the same directory,

you can clearly see the name of the patch file in front of it. There are two types of icons, one is a simple executable icon, and the other is an executable icon that marks the compressed file.

From the Attribute Analysis Format

The icon for the WindowsServer2003-KB823559-x86-ENU.exe file is a simple executable icon. You can see the help information for this patch from Figure 2 and found that it uses the Microsoft update program to install the patch. The version information of the patch can be viewed from Figure 3. It is made by SFXCAB.EXE, and all other patches with common executable file icons have similar properties.

The icon for the DirectX9-KB819696-x86-ENU.exe file is an executable file icon for the compressed file. You can view the help information for the patch. The parameters it recognizes do not include /U and /Z, and if you use the /U parameter to run it will generate an error. Similarly, looking at the version information of the patch, it can be seen that the DirectX9-KB819696-x86-ENU patch is derived from WEXTRACT.EXE, and all other patches with executable file icons with flag compressed files have similar characteristics. .

It is now clear that Windows has two different types of patches, different patches, and different parameters.

Automatically distinguishing patch formats

How do you distinguish between these two different types of patches in a batch file? The most secure way is to find a small program to detect the patch file resource information. If the patch resource includes an executable file icon that marks the compressed file, then the patch is the second type of patch, only the /Q parameter is used, if the patch resource is Excluding the icon, then the first type of patch, you can use the /U /Q /Z parameters to install the patch.

Here is an easier way to use only Windows internal commands, no additional programs are required. Find the feature string in the patch file. If a string exists only in a certain type of patch, you can distinguish the type of patch based on this.

Step 1: As shown in Figure 4, open the WindowsServer2003-

KB823559-x86-ENU.exe file and the DirectX9-KB819696-x86-ENU.exe file with a text editor. Many feature strings, such as the string "_SFX_CAB_EXE_PATH", exist only in the patch of the SFXCAB.EXE type, while the strings "CABINET" and "WEXTRACT" are only present in the patch file of the WEXTRACT.EXE type. So you can use the method of finding a string to determine the type of patch file.

Step 2: Enter “cmd” in the &startquo;run"run" menu, and then go to the folder where the patch is located, run the following command, you can specify the parameters required for the patch file:

(@findstr _SFX_CAB_EXE_PATH patch file name >nul && @echo parameter /U /Q /Z)

Copyright © Windows knowledge All Rights Reserved