标题: [系统相关] 求生成电脑安装软件清单及对应文件安装目录的bat脚本 [打印本页]
作者: 联想不是你的 时间: 2024-1-17 16:04 标题: 求生成电脑安装软件清单及对应文件安装目录的bat脚本
求一个可以生成电脑安装软件清单及对应文件安装目录的bat
作者: Batcher 时间: 2024-1-17 22:08
回复 1# 联想不是你的
Win7? Win10? Win11?
作者: ShowCode 时间: 2024-1-18 08:42
回复 1# 联想不是你的
V1.bat- # & cls & @cd /d "%~dp0" & powershell -c "Get-Content '%~0' | Out-String | Invoke-Expression " & pause & exit /b
- function Get-InstalledSoftwares
- {
- #
- # Read registry key as product entity.
- #
- function ConvertTo-ProductEntity
- {
- param([Microsoft.Win32.RegistryKey]$RegKey)
- $product = '' | select Name,Publisher,Version
- $product.Name = $_.GetValue("DisplayName")
- $product.Publisher = $_.GetValue("Publisher")
- $product.Version = $_.GetValue("DisplayVersion")
-
- if( -not [string]::IsNullOrEmpty($product.Name)){
- $product
- }
- }
-
- $UninstallPaths = @(,
- # For local machine.
- 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall',
- # For current user.
- 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall')
-
- # For 32bit softwares that were installed on 64bit operating system.
- if([Environment]::Is64BitOperatingSystem) {
- $UninstallPaths += 'HKLM:SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall'
- }
- $UninstallPaths | foreach {
- Get-ChildItem $_ | foreach {
- ConvertTo-ProductEntity -RegKey $_
- }
- }
- }
- Get-InstalledSoftwares
复制代码
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |