Files
winutil/functions/private/Test-WinUtilPackageManager.ps1
T

27 lines
674 B
PowerShell
Raw Normal View History

+3
2023-03-07 12:28:00 -08:00
function Test-WinUtilPackageManager {
<#
.DESCRIPTION
2023-08-02 19:43:52 -05:00
Checks for Winget or Choco depending on the parameter
+3
2023-03-07 12:28:00 -08:00
#>
Param(
[System.Management.Automation.SwitchParameter]$winget,
[System.Management.Automation.SwitchParameter]$choco
)
if($winget){
if (Test-Path ~\AppData\Local\Microsoft\WindowsApps\winget.exe) {
return $true
}
}
if($choco){
if ((Get-Command -Name choco -ErrorAction Ignore) -and ($chocoVersion = (Get-Item "$env:ChocolateyInstall\choco.exe" -ErrorAction Ignore).VersionInfo.ProductVersion)){
return $true
}
}
return $false
}