< Back

Get-CurrentLineNumber

Mon Jan 13, 2020 12:50 am

NAME Get-CurrentLineNumber



SYNOPSIS

Wrapper function to return $MyInvocation.ScriptLineNumber





SYNTAX

Get-CurrentLineNumber [<CommonParameters>]





DESCRIPTION

Use this in debugging where a message came from.





PARAMETERS

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

[int]





-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Invoke-ChainsawMessage -Debug -Message "What line number is this?" -LineNumber $(Get-CurrentLineNumber)



Get-CurrentLineNumber











RELATED LINKS