[研究][BAT]顯示安裝軟體列表 (Windows Server 2019)
2024-04-02
下面這行指令查詢的是 32 位元應用程式在 64 位元作業系統上的安裝資訊。在 64 位元的 Windows 系統中,有一個特殊的註冊表分支 Wow6432Node 用於存儲 32 位元應用程式的註冊表信息。
注意,用【記事本】存檔,要選ANSI,不是UTF-8
1.bat
@ECHO OFF Reg Query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" /s /v DisplayName |
下面這行指令查詢的是 64 位元應用程式在 64 位元作業系統上的安裝資訊。這個註冊表分支直接位於 HKLM\SOFTWARE 下,不涉及到 Wow6432Node 分支,因此是查詢 64 位元應用程式的安裝資訊。
2.bat
@ECHO OFF Reg Query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" /s /v DisplayName |
********************************************************************************
1.bat 執行結果
C:\>@ECHO OFF Reg Query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" /s /v DisplayName HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\ASPRAClient_Prod DisplayName REG_SZ TWCA憑證小幫手(remove only) HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Asunsoft SQL Password Geeker DisplayName REG_SZ Asunsoft SQL Password Geeker HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\b2d8f357 DisplayName REG_SZ Visual Studio Enterprise 2019 HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\F5 Networks Client Components DisplayName REG_SZ BIG-IP Edge Client Components (All Users) ...(略) |
改版一下,不顯示 HKEY那行
1A.bat
@echo off for /f "tokens=3,* delims= " %%a in ('Reg Query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" /s /v DisplayName ^| findstr /i "DisplayName"') do echo %%a %%b |
1A.bat 執行結果
C:\TEMP>1a TWCA憑證小幫手(remove only) Asunsoft SQL Password Geeker Visual Studio Enterprise 2019 BIG-IP Edge Client Components (All Users) Visual Studio Enterprise 2022 |
改版一下,排序
1B.bat
@echo off setlocal enabledelayedexpansion REM 使用 FOR /F 循環將輸出放入陣列中 set i=0 for /f "tokens=3,* delims= " %%a in ('Reg Query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" /s /v DisplayName ^| findstr /i "DisplayName"') do ( set /a i+=1 set "array[!i!]=%%a %%b" ) REM 排序陣列 for /l %%i in (1,1,%i%) do ( for /l %%j in (%%i,1,%i%) do ( if "!array[%%i]!" gtr "!array[%%j]!" ( set "temp=!array[%%i]!" set "array[%%i]=!array[%%j]!" set "array[%%j]=!temp!" ) ) ) REM 顯示排序後的結果 for /l %%k in (1,1,%i%) do echo !array[%%k]! endlocal |
1B.bat 執行結果
C:\TEMP>1b Asunsoft SQL Password Geeker BIG-IP Edge Client Components (All Users) Browser for SQL Server 2019 Chrome Remote Desktop Host ClickOnce Bootstrapper Package for Microsoft .NET Framework Entity Framework 6.2.0 Tools for Visual Studio 2019 Entity Framework 6.2.0 Tools for Visual Studio 2022 FileZilla 3.66.5 FreeFileSync Git Extensions 3.5.4.12724 Google Chrome HashCalc 2.02 Helix Core Apps HiCOS PKI Smart Card icecap_collection_neutral icecap_collection_neutral icecap_collectionresources icecap_collectionresources icecap_collectionresourcesx64 icecap_collectionresourcesx64 Image Analyzer Integration Services IntelliTraceProfilerProxy Microsoft .NET Core Runtime - 3.1.32 (x86) Microsoft .NET CoreRuntime For CoreCon Microsoft .NET CoreRuntime SDK Microsoft .NET Framework 4 Multi-Targeting Pack Microsoft .NET Framework 4.5 Multi-Targeting Pack Microsoft .NET Framework 4.5.1 Multi-Targeting Pack Microsoft .NET Framework 4.5.2 Multi-Targeting Pack Microsoft .NET Framework 4.6 Targeting Pack Microsoft .NET Framework 4.6.1 Targeting Pack Microsoft .NET Framework 4.7.2 SDK Microsoft .NET Framework 4.7.2 Targeting Pack Microsoft .NET Framework 4.7.2 目標套件 (繁體中文) Microsoft .NET Framework 4.8 SDK (繁體中文) Microsoft .NET Framework 4.8 SDK Microsoft .NET Framework 4.8 Targeting Pack Microsoft .NET Framework 4.8 目標套件 (繁體中文) Microsoft .NET Host - 8.0.3 (x86) Microsoft .NET Host FX Resolver - 5.0.17 (x86) Microsoft .NET Host FX Resolver - 8.0.3 (x86) Microsoft .NET Native SDK Microsoft .NET Runtime - 5.0.17 (x86) Microsoft .NET Runtime - 6.0.12 (x86) Microsoft .NET Runtime - 6.0.28 (x86) Microsoft .NET Runtime - 7.0.17 (x86) Microsoft .NET Runtime - 8.0.3 (x86) Microsoft .NET Targeting Pack - 6.0.28 (x86) Microsoft .NET Targeting Pack - 7.0.17 (x86) Microsoft .NET Targeting Pack - 8.0.3 (x86) Microsoft Analysis Services OLE DB 提供者 Microsoft ASP.NET Core 3.1.32 Shared Framework (x86) Microsoft ASP.NET Core 5.0.17 Shared Framework (x86) Microsoft ASP.NET Core 6.0.28 Shared Framework (x86) Microsoft ASP.NET Core 6.0.28 Targeting Pack (x86) Microsoft ASP.NET Core 7.0.17 Shared Framework (x86) Microsoft ASP.NET Core 7.0.17 Targeting Pack (x86) Microsoft ASP.NET Core 8.0.3 Shared Framework (x86) Microsoft ASP.NET Core 8.0.3 Targeting Pack (x86) Microsoft ASP.NET Diagnostic Pack for Visual Studio Microsoft ASP.NET MVC 2 Microsoft ASP.NET Web Tools Packages 16.0 - CHT Microsoft ASP.NET Web Tools Packages 16.0 - ENU Microsoft ASP.NET Web Tools Packages 17.0 - CHT Microsoft ASP.NET Web Tools Packages 17.0 - ENU Microsoft Azure Storage Emulator - v5.10 Microsoft Azure Storage Emulator - v5.10 Microsoft Edge Update Microsoft Edge WebView2 執行階段 Microsoft Edge Microsoft Help Viewer 2.3 語言套件 - 繁體中文 Microsoft Help Viewer 2.3 語言套件 - 繁體中文 Microsoft Help Viewer 2.3 Microsoft Help Viewer 2.3 Microsoft SQL Server Management Studio - 19.3 Microsoft System CLR Types for SQL Server 2019 CTP2.2 Microsoft TestPlatform SDK Local Feed Microsoft Visual C++ 2008 Redistributable - x86 9.0.30729.6161 Microsoft Visual C++ 2010 x86 Redistributable - 10.0.40219 Microsoft Visual C++ 2012 Redistributable (x64) - 11.0.61030 Microsoft Visual C++ 2012 Redistributable (x86) - 11.0.61030 Microsoft Visual C++ 2012 x86 Additional Runtime - 11.0.61030 Microsoft Visual C++ 2012 x86 Minimum Runtime - 11.0.61030 Microsoft Visual C++ 2013 Redistributable (x64) - 12.0.30501 Microsoft Visual C++ 2013 Redistributable (x86) - 12.0.30501 Microsoft Visual C++ 2013 x86 Additional Runtime - 12.0.21005 Microsoft Visual C++ 2013 x86 Minimum Runtime - 12.0.21005 Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.38.33130 Microsoft Visual C++ 2015-2022 Redistributable (x86) - 14.38.33130 Microsoft Visual C++ 2022 X86 Additional Runtime - 14.38.33130 Microsoft Visual C++ 2022 X86 Minimum Runtime - 14.38.33130 Microsoft Visual Studio Setup Configuration Microsoft Visual Studio Setup WMI Provider Microsoft Visual Studio Tools for Applications 2017 x86 Hosting Support Microsoft Visual Studio Tools for Applications 2017 Microsoft Visual Studio Tools for Applications 2019 x86 Hosting Support Microsoft Visual Studio Tools for Applications 2019 Microsoft Windows Desktop Runtime - 3.1.32 (x86) Microsoft Windows Desktop Runtime - 5.0.17 (x86) Microsoft Windows Desktop Runtime - 6.0.28 (x86) Microsoft Windows Desktop Runtime - 7.0.17 (x86) Microsoft Windows Desktop Runtime - 8.0.3 (x86) Microsoft Windows Desktop Targeting Pack - 6.0.28 (x86) Microsoft Windows Desktop Targeting Pack - 7.0.17 (x86) Microsoft Windows Desktop Targeting Pack - 8.0.3 (x86) Mozilla Thunderbird (x86 zh-TW) Nmap 7.94 Npcap SQL Server Management Studio 語言套件 - 繁體中文 SQL Server Management Studio SSMS Post Install Tasks TWCA憑證小幫手(remove only) TypeScript SDK U Webinar Update for (KB2504637) vcpp_crt.redist.clickonce vcpp_crt.redist.clickonce Visual Studio 2017 Isolated Shell for SSMS LangPack - 繁體中文 Visual Studio 2017 Isolated Shell for SSMS Visual Studio Enterprise 2019 Visual Studio Enterprise 2022 VS Immersive Activate Helper vs_BlendMsi vs_clickoncebootstrappermsi vs_clickoncebootstrappermsires vs_clickoncesigntoolmsi vs_codecoveragemsi vs_communitymsi vs_communitymsires vs_communitysharedmsi vs_CoreEditorFonts vs_devenvmsi vs_devenvsharedmsi vs_filehandler_amd64 vs_filehandler_x86 vs_FileTracker_Singleton vs_githubprotocolhandlermsi vs_minshellinteropmsi vs_minshellinteropsharedmsi vs_minshellmsi vs_minshellmsires vs_minshellsharedmsi vs_networkemulationmsi_x64 vs_SQLClickOnceBootstrappermsi vs_tipsmsi vs_vswebprotocolselectormsi vs_vswebprotocolselectormsires Windows Phone SDK 8.0 Assemblies for Visual Studio 2019 XnView 2.51.1 跨平台網頁元件 版本 1.3.4.103346 適用於 Visual Studio 的 Microsoft .NET Framework Cumulative Intellisense Pack (繁體中文) C:\TEMP> |
(完)
相關
沒有留言:
張貼留言