private/Test-CommandWinget.ps1

function Test-CommandWinget {
    <#
    .SYNOPSIS
        Tests whether WinGet is available in the current session PATH
 
    .DESCRIPTION
        Uses command discovery to locate winget in the current session PATH.
        Returns $true when the command is found; otherwise, returns $false.
        This function does not execute WinGet or inspect App Installer.
 
    .EXAMPLE
        PS> Test-CommandWinget
 
        Tests whether the winget command is available in the current session
        PATH.
 
    .INPUTS
        None. This function does not accept pipeline input.
 
    .OUTPUTS
        System.Boolean. Returns $true when winget is found; otherwise, returns
        $false.
 
    .NOTES
        Author: David Segura
        Company: Recast Software
        Version: 1.0.0
        Date: 2026-08-28
 
    .LINK
        https://learn.microsoft.com/windows/package-manager/winget/
    #>

    [OutputType([bool])]
    param ()

    return ($null -ne (Get-Command -Name 'winget' -ErrorAction SilentlyContinue))
}