Shahar Gvirtz's Weblog

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.

Posted: Jan 24 2008, 09:36 AM by shahargs | with no comments |
Filed under: ,

Comments

No Comments

Leave a Comment

(required) 

(required) 

(optional)

(required)