this question has answer here:
- powershell pass object[] function 1 answer
i trying create hash table,
$input = @{'g'=100;'e'=50;'d'=35;'a'=100} and not figure out life of me why wouldn't display usual commands write-host, or $input. write-host returned system.collections.arraylist+arraylistenumeratorsimple. $input returned nothing. no error thrown.
on hunch renamed hash table, , boom, appears normal. opening new powershell tab in ise, observe variable $input filled in intellisense though have not defined in environment.
now i'm curious: system variable $input for? i'm on version 4.
$inputcontains enumerator enumerates input passed function.
$inputvariable available functions , script blocks (which unnamed functions). in process block of function,$inputvariable enumerates object in pipeline. when process block completes, there no objects left in pipeline,$inputvariable enumerates empty collection. if function not have process block, in end block,$inputvariable enumerates collection of input function.
this available in powershell:
get-help about_automatic_variables i have open feature request set-strictmode handle detection of this.
Comments
Post a Comment