Confused about why PowerShell treats a function different from a childitem, even if same type -


I'm confused about the difference between these two things:

  $ env : Path  

and

  function path {$ env: path} path  

Both return strings, Member. Nevertheless - the match does not do the same thing on both sides.

If I use the path on $ env: path, it works as I expected, is returning true / false but if I meet the path (new function), then it Always returns the path, ignoring matches

I am confused because both are return strings and therefore they should do the same thing. Does the function need to do something special to get the same result?

The difference is that Dawn is being treated as a parameter in the path function is. Then,

  $ (path) -mail "foo"  

or

  (path) -mail "foo " 

Works equally well, formerly a subdivision, later nested pipeline (usually there is a similar effect in such cases, but there is a subtle difference between them. )

Verify:

  ps & gt; Function path {$ env: path; Writing host "Parameters: $ Algues"} ps & gt; Path-match "foo" (env: path extended) parameter: -mailfu  

-Oisin


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -