如何透過命令列列出新增/刪除 WinXP/Win7 顯示的所有應用程式?

如何透過命令列列出新增/刪除 WinXP/Win7 顯示的所有應用程式?

我試圖透過命令列列出新增/刪除程式清單(WinXP/Win7)中顯示的所有已安裝應用程式。據我了解,對於 Win7,它被稱為 cp 的「程式和功能」。

我嘗試過 wmic,但它只列出使用 MSI 安裝的程式。我嘗試查詢註冊表(HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall 以及 wow6432node)。

我仍然無法捕捉 Spotify(很好的例子);它出現在新增/刪除部分,但不在這些位置。

有什麼想法嗎?

-多姆

答案1

看起來這可以透過wmic命令來完成
嘗試這個:

wmic product  

顯示電腦上安裝的所有內容的清單
來源:
http://www.sepago.de/d/helge/2010/01/14/how-to-list-all-installed-applications-from-the-command-line http://technet.microsoft.com/en-us/library/bb742610.aspx#ECAA

此頁面說它適用於 Windows Vista 和 7,但我也在 Windows XP 上測試了 wmic
從 Windows 命令列取得已安裝應用程式的列表

另外,此頁說明檢查註冊表項的方法可能不準確
http://community.spiceworks.com/how_to/show/2238-how-add-remove-programs-works

以下是有關使用 wmic 還可以執行哪些操作的更多資訊:
http://betanews.com/2011/01/14/wmic-the-best-command-line-tool-you-ve-never-used/
從這個網站,專門針對您的問題:

該程式還可以提供系統許多其他方面的詳細資訊。命令如下:

wmic 產品清單簡介

wmic 服務清單簡介

wmic 行程清單簡介

wmic 啟動清單簡介

例如,將列出您安裝的軟體、服務、正在執行的進程和 Windows 啟動程式。

答案2

我認為您不會對任何 cmd 方法感到滿意,因為它們並不完整。如果你對 Powershell 沒意見,那麼這給了我一切:

If (!([Diagnostics.Process]::GetCurrentProcess(). Path -match '\\syswow64\\')) {
    $unistallPath = "\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
    $unistallWow6432Path = "\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\"
    
    @( 
        if (Test-Path "HKLM:$unistallWow6432Path" ) { Get-ChildItem "HKLM:$unistallWow6432Path"} 
        if (Test-Path "HKLM:$unistallPath" ) { Get-ChildItem "HKLM:$unistallPath" } 
        if (Test-Path "HKCU:$unistallWow6432Path") { Get-ChildItem "HKCU:$unistallWow6432Path"} 
        if (Test-Path "HKCU:$unistallPath" ) { Get-ChildItem "HKCU:$unistallPath" } 
    ) | 
    ForEach-Object { Get-ItemProperty $_.PSPath } | 
    Where-Object { 
        $_.DisplayName -and !$_.SystemComponent -and !$_.ReleaseType -and !$_.ParentKeyName -and ($_.UninstallString -or $_.NoRemove) 
    } | 
    Sort-Object DisplayName | 
    Select-Object DisplayName
} else {
    "You are running 32-bit Powershell on 64-bit system. Please run 64-bit Powershell instead." | 
    Write-Host -ForegroundColor Red
}

相關內容