In PowerShell, I can use Trace-Command
to troubleshoot parameter binding, type conversion, etc. Ex:
Trace-Command -PSHost -Name ParameterBinding -Expression { $null = "c:\" | dir} ... DEBUG: ParameterBinding Information: 0 : Parameter [Path] PIPELINE INPUT ValueFromPipeline NO COERCION DEBUG: ParameterBinding Information: 0 : BIND arg [c:\] to parameter [Path] DEBUG: ParameterBinding Information: 0 : Binding collection parameter Path: argument type [String], parameter type [System.String[]], collection type Array, eleme nt type [System.String], no coerceElementType ...
While debugging some strange actions in PS, I wanted to trace how the -lt
comparison -lt
(maybe it is converted to [int][char]"x"
for each character, etc.). I tried to use Trace-Command
but returns nothing.
Trace-Command -PSHost -Name TypeMatch, TypeConversion -Expression { "Less" -lt "less" } #No trace-output, only returned value False #Get any type of trace-informatino Trace-Command -PSHost -Name * -Expression { "Less" -lt "less" } #No trace-output, only returned value False
Is there any way to find out how these internal operators work behind the scenes? Tracing Information? Detailed conclusion? I used -lt
and -gt
as an example, but it could be like an &
-operator, and how it analyzes a command or something else.
source share