Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 22 additions & 16 deletions src/System.Management.Automation/engine/hostifaces/PowerShell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -946,9 +946,11 @@ private static PowerShell Create(bool isNested, PSCommand psCommand, Collection<

/// <summary>
/// Add a cmdlet to construct a command pipeline.
/// For example, to construct a command string "get-process | sort-object",
/// For example, to construct a command string "Get-Process | Sort-Object",
/// <code>
/// PowerShell shell = PowerShell.Create("get-process").AddCommand("sort-object");
/// PowerShell shell = PowerShell.Create()
/// .AddCommand("Get-Process")
/// .AddCommand("Sort-Object");
/// </code>
/// </summary>
/// <param name="cmdlet">
Expand Down Expand Up @@ -984,9 +986,11 @@ public PowerShell AddCommand(string cmdlet)

/// <summary>
/// Add a cmdlet to construct a command pipeline.
/// For example, to construct a command string "get-process | sort-object",
/// For example, to construct a command string "Get-Process | Sort-Object",
/// <code>
/// PowerShell shell = PowerShell.Create("get-process").AddCommand("sort-object");
/// PowerShell shell = PowerShell.Create()
/// .AddCommand("Get-Process", true)
/// .AddCommand("Sort-Object", true);
/// </code>
/// </summary>
/// <param name="cmdlet">
Expand Down Expand Up @@ -1025,10 +1029,10 @@ public PowerShell AddCommand(string cmdlet, bool useLocalScope)

/// <summary>
/// Add a piece of script to construct a command pipeline.
/// For example, to construct a command string "get-process | foreach { $_.Name }"
/// For example, to construct a command string "Get-Process | ForEach-Object { $_.Name }"
/// <code>
/// PowerShell shell = PowerShell.Create("get-process").
/// AddCommand("foreach { $_.Name }", true);
/// PowerShell shell = PowerShell.Create()
/// .AddScript("Get-Process | ForEach-Object { $_.Name }");
/// </code>
/// </summary>
/// <param name="script">
Expand Down Expand Up @@ -1064,10 +1068,10 @@ public PowerShell AddScript(string script)

/// <summary>
/// Add a piece of script to construct a command pipeline.
/// For example, to construct a command string "get-process | foreach { $_.Name }"
/// For example, to construct a command string "Get-Process | ForEach-Object { $_.Name }"
/// <code>
/// PowerShell shell = PowerShell.Create("get-process").
/// AddCommand("foreach { $_.Name }", true);
/// PowerShell shell = PowerShell.Create()
/// .AddScript("Get-Process | ForEach-Object { $_.Name }", true);
/// </code>
/// </summary>
/// <param name="script">
Expand Down Expand Up @@ -1173,10 +1177,11 @@ public PowerShell AddCommand(CommandInfo commandInfo)

/// <summary>
/// Add a parameter to the last added command.
/// For example, to construct a command string "get-process | select-object -property name"
/// For example, to construct a command string "Get-Process | Select-Object -Property Name"
/// <code>
/// PowerShell shell = PowerShell.Create("get-process").
/// AddCommand("select-object").AddParameter("property","name");
/// PowerShell shell = PowerShell.Create()
/// .AddCommand("Get-Process")
/// .AddCommand("Select-Object").AddParameter("Property", "Name");
/// </code>
/// </summary>
/// <param name="parameterName">
Expand Down Expand Up @@ -1378,10 +1383,11 @@ public PowerShell AddParameters(IDictionary parameters)

/// <summary>
/// Adds an argument to the last added command.
/// For example, to construct a command string "get-process | select-object name"
/// For example, to construct a command string "Get-Process | Select-Object Name"
/// <code>
/// PowerShell shell = PowerShell.Create("get-process").
/// AddCommand("select-object").AddParameter("name");
/// PowerShell shell = PowerShell.Create()
/// .AddCommand("Get-Process")
/// .AddCommand("Select-Object").AddArgument("Name");
/// </code>
/// 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
Expand Down