PowerShell.AddArgument(Object) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adds an argument to the last added command. For example, to construct a command string "get-process | select-object name"
PowerShell shell = PowerShell.Create("get-process").
AddCommand("select-object").AddParameter("name");
This will add the value "name" to the positional parameter list of "select-object" cmdlet. When the command is invoked, this value will get bound to positional parameter 0 of the "select-object" cmdlet which is "Property".
public:
System::Management::Automation::PowerShell ^ AddArgument(System::Object ^ value);
public System.Management.Automation.PowerShell AddArgument (object value);
member this.AddArgument : obj -> System.Management.Automation.PowerShell
Public Function AddArgument (value As Object) As PowerShell
Parameters
- value
- Object
Value for the parameter.
Returns
A PSCommand instance parameter value value
added
to the parameter list of the last command.
Remarks
This method is not thread safe.