mercredi 25 août 2021

How do I get the original expression used to invoke a powershell function?

How would I go about retrieving the original expression used to invoke a Powershell function, from within the function itself? As in, the expression as it was typed/read from the script or command line.

I know that one can use $MyInvocation.Line to retrieve the first line of the invocation expression, however this won't correctly retrieve a multi-line expression.

( This answer only retrieves the first line, or the arguments, not the original expression)





Aucun commentaire:

Enregistrer un commentaire