使用下面的代码构建已安装应用程序的列表(如果它们已安装),但是,我在每个条目的新行上获得结果。我想知道我怎样才能把这些线连接起来。
clear
$appsToCheck = "WebEx","Adobe Acrobat"
function Check_Program_Installed {
[CmdletBinding()]
Param(
[Parameter(Position = 0, Mandatory=$true, ValueFromPipeline = $true)]
$Name
)
$app = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*", "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" |
Where-Object { $_.DisplayName -match $Name } |
Select-Object DisplayName, DisplayVersion, InstallDate, Version
if ($app) {
Write-Host "$($app.DisplayName) v$($app.DisplayVersion) | "
}
}
foreach ($app in $appsToCheck) {
Check_Program_Installed "$app"
}
1条答案
按热度按时间carvr3hs1#
你是在追求
Write-Host -NoNewline
吗?