Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ for the following automatic variables:

```powershell
$_
$Args
$args
$Input
$MyInvocation
$PSBoundParameters
Expand All @@ -144,7 +144,7 @@ variable.
For example,

```powershell
$scriptArgs = $Args
$scriptArgs = $args
$scriptname = $MyInvocation.PSCommandPath
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,15 +423,15 @@ need to declare or enumerate the command parameters, or change the function
when command parameters change.

The following sample function calls the `Get-Command` cmdlet. The command uses
`@Args` to represent the parameters of `Get-Command`.
`@args` to represent the parameters of `Get-Command`.

```powershell
function Get-MyCommand { Get-Command @Args }
function Get-MyCommand { Get-Command @args }
```

You can use all the parameters of `Get-Command` when you call the
`Get-MyCommand` function. The parameters and parameter values are passed to the
command using `@Args`.
command using `@args`.

```powershell
Get-MyCommand -Name Get-ChildItem
Expand All @@ -443,7 +443,7 @@ CommandType Name ModuleName
Cmdlet Get-ChildItem Microsoft.PowerShell.Management
```

The `@Args` feature uses the `$Args` automatic parameter, which represents
The `@args` feature uses the `$args` automatic parameter, which represents
undeclared cmdlet parameters and values from remaining arguments.

For more information, see [about_Splatting][19].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ When you use the `CmdletBinding` attribute, PowerShell automatically adds the
Common Parameters. You can't create any parameters that use the same names as
the Common Parameters. For more information, see [about_CommonParameters][06].

Beginning in PowerShell 3.0, you can use splatting with `@Args` to represent
Beginning in PowerShell 3.0, you can use splatting with `@args` to represent
the parameters in a command. Splatting is valid on simple and advanced
functions. For more information, see [about_Functions][14] and
[about_Splatting][17].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ the Common Parameters. For more information, see [about_CommonParameters][02].
PowerShell binds the parameters of functions that have the `CmdletBinding`
attribute in the same way that it binds the parameters of compiled cmdlets. The
`$PSCmdlet` automatic variable is available to functions with the
`CmdletBinding` attribute, but the `$Args` variable is not available.
`CmdletBinding` attribute, but the `$args` variable is not available.

In functions that have the `CmdletBinding` attribute, unknown parameters and
positional arguments that have no matching positional parameters cause
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,22 +258,22 @@ You can use splatting to represent the parameters of a command. This technique
is useful when you are creating a proxy function, that is, a function that
calls another command. This feature is introduced in Windows PowerShell 3.0.

To splat the parameters of a command, use `@Args` to represent the command
To splat the parameters of a command, use `@args` to represent the command
parameters. This technique is easier than enumerating command parameters and
it works without revision even if the parameters of the called command change.

The feature uses the `$Args` automatic variable, which contains all unassigned
The feature uses the `$args` automatic variable, which contains all unassigned
parameter values.

For example, the following function calls the `Get-Process` cmdlet. In this
function, `@Args` represents all the parameters of the `Get-Process` cmdlet.
function, `@args` represents all the parameters of the `Get-Process` cmdlet.

```powershell
function Get-MyProcess { Get-Process @Args }
function Get-MyProcess { Get-Process @args }
```

When you use the `Get-MyProcess` function, all unassigned parameters and
parameter values are passed to `@Args`, as shown in the following commands.
parameter values are passed to `@args`, as shown in the following commands.

```powershell
Get-MyProcess -Name PowerShell
Expand All @@ -295,16 +295,16 @@ ProductVersion FileVersion FileName
6.2.9200.16384 6.2.9200.1638... C:\Windows\system32\WindowsPowerShell\...
```

You can use `@Args` in a function that has explicitly declared parameters. You
You can use `@args` in a function that has explicitly declared parameters. You
can use it more than once in a function, but all parameters that you enter are
passed to all instances of `@Args`, as shown in the following example.
passed to all instances of `@args`, as shown in the following example.

```powershell
function Get-MyCommand
{
Param ([switch]$P, [switch]$C)
if ($P) { Get-Process @Args }
if ($C) { Get-Command @Args }
if ($P) { Get-Process @args }
if ($C) { Get-Command @args }
}

Get-MyCommand -P -C -Name PowerShell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ event is raised instead of sending the event to the event queue. Enclose the com
(`{}`) to create a script block.

The value of **Action** can include the `$Event`, `$EventSubscriber`, `$Sender`, `$EventArgs`, and
`$Args` automatic variables, which provide information about the event to the **Action** script
`$args` automatic variables, which provide information about the event to the **Action** script
block. For more information, see [about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md).

When you specify an action, `Register-WmiEvent` returns an event job object that represents that
Expand Down
4 changes: 2 additions & 2 deletions reference/5.1/Microsoft.PowerShell.Utility/Get-Event.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ The `Get-Event` cmdlet returns a **PSEventArgs** object
automatic variable contains this value.

- SourceArgs. All parameters of the original event signature. For a standard event signature,
`$Args[0]` represents the sender, and `$Args[1]` represents the **SourceEventArgs**. In the
value of the **Action** parameter, the `$Args` automatic variable contains this value.
`$args[0]` represents the sender, and `$args[1]` represents the **SourceEventArgs**. In the
value of the **Action** parameter, the `$args` automatic variable contains this value.

- SourceIdentifier. A string that identifies the event subscription. In the value of the
**Action** parameter, the **SourceIdentifier** property of the `$Event` automatic variable
Expand Down
2 changes: 1 addition & 1 deletion reference/5.1/Microsoft.PowerShell.Utility/New-Event.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ PS C:\> function Enable-ProcessCreationEvent
$Identifier = "WMI.ProcessCreated"
Register-ObjectEvent $ProcessWatcher "EventArrived" -SupportEvent $Identifier -Action
{
[void] (New-Event -SourceID "PowerShell.ProcessCreated" -Sender $Args[0] -EventArguments $Args[1].SourceEventArgs.NewEvent.TargetInstance)
[void] (New-Event -SourceID "PowerShell.ProcessCreated" -Sender $args[0] -EventArguments $args[1].SourceEventArgs.NewEvent.TargetInstance)
}
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ instead of sending the event to the event queue. Enclose the commands in braces
script block.

The value of the **Action** parameter can include the `$Event`, `$EventSubscriber`, `$Sender`,
`$EventArgs`, and `$Args` automatic variables, which provide information about the event to the
`$EventArgs`, and `$args` automatic variables, which provide information about the event to the
**Action** script block. For more information, see
[about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ raised, instead of sending the event to the event queue. Enclose the commands in
create a script block.

The value of the **Action** parameter can include the `$Event`, `$EventSubscriber`, `$Sender`,
`$EventArgs`, and `$Args` automatic variables. These variables provide information about the event
`$EventArgs`, and `$args` automatic variables. These variables provide information about the event
to the **Action** script block. For more information, see [about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md).

When you specify an action, `Register-ObjectEvent` returns an event job object that represents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ for the following automatic variables:

```powershell
$_
$Args
$args
$Input
$MyInvocation
$PSBoundParameters
Expand All @@ -144,7 +144,7 @@ variable.
For example,

```powershell
$scriptArgs = $Args
$scriptArgs = $args
$scriptname = $MyInvocation.PSCommandPath
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,15 +450,15 @@ need to declare or enumerate the command parameters, or change the function
when command parameters change.

The following sample function calls the `Get-Command` cmdlet. The command uses
`@Args` to represent the parameters of `Get-Command`.
`@args` to represent the parameters of `Get-Command`.

```powershell
function Get-MyCommand { Get-Command @Args }
function Get-MyCommand { Get-Command @args }
```

You can use all the parameters of `Get-Command` when you call the
`Get-MyCommand` function. The parameters and parameter values are passed to the
command using `@Args`.
command using `@args`.

```powershell
Get-MyCommand -Name Get-ChildItem
Expand All @@ -470,7 +470,7 @@ CommandType Name ModuleName
Cmdlet Get-ChildItem Microsoft.PowerShell.Management
```

The `@Args` feature uses the `$Args` automatic parameter, which represents
The `@args` feature uses the `$args` automatic parameter, which represents
undeclared cmdlet parameters and values from remaining arguments.

For more information, see [about_Splatting][19].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ When you use the `CmdletBinding` attribute, PowerShell automatically adds the
Common Parameters. You can't create any parameters that use the same names as
the Common Parameters. For more information, see [about_CommonParameters][06].

Beginning in PowerShell 3.0, you can use splatting with `@Args` to represent
Beginning in PowerShell 3.0, you can use splatting with `@args` to represent
the parameters in a command. Splatting is valid on simple and advanced
functions. For more information, see [about_Functions][14] and
[about_Splatting][17].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ the Common Parameters. For more information, see [about_CommonParameters][02].
PowerShell binds the parameters of functions that have the `CmdletBinding`
attribute in the same way that it binds the parameters of compiled cmdlets. The
`$PSCmdlet` automatic variable is available to functions with the
`CmdletBinding` attribute, but the `$Args` variable is not available.
`CmdletBinding` attribute, but the `$args` variable is not available.

In functions that have the `CmdletBinding` attribute, unknown parameters and
positional arguments that have no matching positional parameters cause
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,22 +301,22 @@ You can use splatting to represent the parameters of a command. This technique
is useful when you are creating a proxy function, that is, a function that
calls another command. This feature is introduced in Windows PowerShell 3.0.

To splat the parameters of a command, use `@Args` to represent the command
To splat the parameters of a command, use `@args` to represent the command
parameters. This technique is easier than enumerating command parameters and
it works without revision even if the parameters of the called command change.

The feature uses the `$Args` automatic variable, which contains all unassigned
The feature uses the `$args` automatic variable, which contains all unassigned
parameter values.

For example, the following function calls the `Get-Process` cmdlet. In this
function, `@Args` represents all the parameters of the `Get-Process` cmdlet.
function, `@args` represents all the parameters of the `Get-Process` cmdlet.

```powershell
function Get-MyProcess { Get-Process @Args }
function Get-MyProcess { Get-Process @args }
```

When you use the `Get-MyProcess` function, all unassigned parameters and
parameter values are passed to `@Args`, as shown in the following commands.
parameter values are passed to `@args`, as shown in the following commands.

```powershell
Get-MyProcess -Name PowerShell
Expand All @@ -338,16 +338,16 @@ ProductVersion FileVersion FileName
6.2.9200.16384 6.2.9200.1638... C:\Windows\system32\WindowsPowerShell\...
```

You can use `@Args` in a function that has explicitly declared parameters. You
You can use `@args` in a function that has explicitly declared parameters. You
can use it more than once in a function, but all parameters that you enter are
passed to all instances of `@Args`, as shown in the following example.
passed to all instances of `@args`, as shown in the following example.

```powershell
function Get-MyCommand
{
Param ([switch]$P, [switch]$C)
if ($P) { Get-Process @Args }
if ($C) { Get-Command @Args }
if ($P) { Get-Process @args }
if ($C) { Get-Command @args }
}

Get-MyCommand -P -C -Name PowerShell
Expand Down
4 changes: 2 additions & 2 deletions reference/7.4/Microsoft.PowerShell.Utility/Get-Event.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ The `Get-Event` cmdlet returns a **PSEventArgs** object
automatic variable contains this value.

- SourceArgs. All parameters of the original event signature. For a standard event signature,
`$Args[0]` represents the sender, and `$Args[1]` represents the **SourceEventArgs**. In the
value of the **Action** parameter, the `$Args` automatic variable contains this value.
`$args[0]` represents the sender, and `$args[1]` represents the **SourceEventArgs**. In the
value of the **Action** parameter, the `$args` automatic variable contains this value.

- SourceIdentifier. A string that identifies the event subscription. In the value of the
**Action** parameter, the **SourceIdentifier** property of the `$Event` automatic variable
Expand Down
2 changes: 1 addition & 1 deletion reference/7.4/Microsoft.PowerShell.Utility/New-Event.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ PS C:\> function Enable-ProcessCreationEvent
$Identifier = "WMI.ProcessCreated"
Register-ObjectEvent $ProcessWatcher "EventArrived" -SupportEvent $Identifier -Action
{
[void] (New-Event -SourceID "PowerShell.ProcessCreated" -Sender $Args[0] -EventArguments $Args[1].SourceEventArgs.NewEvent.TargetInstance)
[void] (New-Event -SourceID "PowerShell.ProcessCreated" -Sender $args[0] -EventArguments $args[1].SourceEventArgs.NewEvent.TargetInstance)
}
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ instead of sending the event to the event queue. Enclose the commands in braces
script block.

The value of the **Action** parameter can include the `$Event`, `$EventSubscriber`, `$Sender`,
`$EventArgs`, and `$Args` automatic variables, which provide information about the event to the
`$EventArgs`, and `$args` automatic variables, which provide information about the event to the
**Action** script block. For more information, see
[about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ raised, instead of sending the event to the event queue. Enclose the commands in
create a script block.

The value of the **Action** parameter can include the `$Event`, `$EventSubscriber`, `$Sender`,
`$EventArgs`, and `$Args` automatic variables. These variables provide information about the event
`$EventArgs`, and `$args` automatic variables. These variables provide information about the event
to the **Action** script block. For more information, see [about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md).

When you specify an action, `Register-ObjectEvent` returns an event job object that represents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ for the following automatic variables:

```powershell
$_
$Args
$args
$Input
$MyInvocation
$PSBoundParameters
Expand All @@ -144,7 +144,7 @@ variable.
For example,

```powershell
$scriptArgs = $Args
$scriptArgs = $args
$scriptname = $MyInvocation.PSCommandPath
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,15 +450,15 @@ need to declare or enumerate the command parameters, or change the function
when command parameters change.

The following sample function calls the `Get-Command` cmdlet. The command uses
`@Args` to represent the parameters of `Get-Command`.
`@args` to represent the parameters of `Get-Command`.

```powershell
function Get-MyCommand { Get-Command @Args }
function Get-MyCommand { Get-Command @args }
```

You can use all the parameters of `Get-Command` when you call the
`Get-MyCommand` function. The parameters and parameter values are passed to the
command using `@Args`.
command using `@args`.

```powershell
Get-MyCommand -Name Get-ChildItem
Expand All @@ -470,7 +470,7 @@ CommandType Name ModuleName
Cmdlet Get-ChildItem Microsoft.PowerShell.Management
```

The `@Args` feature uses the `$Args` automatic parameter, which represents
The `@args` feature uses the `$args` automatic parameter, which represents
undeclared cmdlet parameters and values from remaining arguments.

For more information, see [about_Splatting][19].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ When you use the `CmdletBinding` attribute, PowerShell automatically adds the
Common Parameters. You can't create any parameters that use the same names as
the Common Parameters. For more information, see [about_CommonParameters][06].

Beginning in PowerShell 3.0, you can use splatting with `@Args` to represent
Beginning in PowerShell 3.0, you can use splatting with `@args` to represent
the parameters in a command. Splatting is valid on simple and advanced
functions. For more information, see [about_Functions][14] and
[about_Splatting][17].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ the Common Parameters. For more information, see [about_CommonParameters][02].
PowerShell binds the parameters of functions that have the `CmdletBinding`
attribute in the same way that it binds the parameters of compiled cmdlets. The
`$PSCmdlet` automatic variable is available to functions with the
`CmdletBinding` attribute, but the `$Args` variable is not available.
`CmdletBinding` attribute, but the `$args` variable is not available.

In functions that have the `CmdletBinding` attribute, unknown parameters and
positional arguments that have no matching positional parameters cause
Expand Down
Loading