How to get the full command line

Someone asked me, and I post here the answer - sometimes, we want to get from our command-let the command that the user entered to use our command-let. we want the full line, with all the command-lets in the pipeline and all the parameters.

In this case, we will use the following code (works only from command-lets that derived from System.Management.Automation.PSCmdlet):

string commandLine = this.MyInvocation.Line;

Shahar.

1 Comment

Comments have been disabled for this content.