Skip to content

Commit ac39029

Browse files
Fix $args automatic variable case (#11824)
1 parent 597ea7c commit ac39029

38 files changed

+91
-91
lines changed

reference/5.1/Microsoft.PowerShell.Core/About/about_Debuggers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ for the following automatic variables:
126126

127127
```powershell
128128
$_
129-
$Args
129+
$args
130130
$Input
131131
$MyInvocation
132132
$PSBoundParameters
@@ -144,7 +144,7 @@ variable.
144144
For example,
145145

146146
```powershell
147-
$scriptArgs = $Args
147+
$scriptArgs = $args
148148
$scriptname = $MyInvocation.PSCommandPath
149149
```
150150

reference/5.1/Microsoft.PowerShell.Core/About/about_Functions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -423,15 +423,15 @@ need to declare or enumerate the command parameters, or change the function
423423
when command parameters change.
424424

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

428428
```powershell
429-
function Get-MyCommand { Get-Command @Args }
429+
function Get-MyCommand { Get-Command @args }
430430
```
431431

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

436436
```powershell
437437
Get-MyCommand -Name Get-ChildItem
@@ -443,7 +443,7 @@ CommandType Name ModuleName
443443
Cmdlet Get-ChildItem Microsoft.PowerShell.Management
444444
```
445445

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

449449
For more information, see [about_Splatting][19].

reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Parameters.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ When you use the `CmdletBinding` attribute, PowerShell automatically adds the
2323
Common Parameters. You can't create any parameters that use the same names as
2424
the Common Parameters. For more information, see [about_CommonParameters][06].
2525

26-
Beginning in PowerShell 3.0, you can use splatting with `@Args` to represent
26+
Beginning in PowerShell 3.0, you can use splatting with `@args` to represent
2727
the parameters in a command. Splatting is valid on simple and advanced
2828
functions. For more information, see [about_Functions][14] and
2929
[about_Splatting][17].

reference/5.1/Microsoft.PowerShell.Core/About/about_Functions_CmdletBindingAttribute.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ the Common Parameters. For more information, see [about_CommonParameters][02].
2424
PowerShell binds the parameters of functions that have the `CmdletBinding`
2525
attribute in the same way that it binds the parameters of compiled cmdlets. The
2626
`$PSCmdlet` automatic variable is available to functions with the
27-
`CmdletBinding` attribute, but the `$Args` variable is not available.
27+
`CmdletBinding` attribute, but the `$args` variable is not available.
2828

2929
In functions that have the `CmdletBinding` attribute, unknown parameters and
3030
positional arguments that have no matching positional parameters cause

reference/5.1/Microsoft.PowerShell.Core/About/about_Splatting.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -258,22 +258,22 @@ You can use splatting to represent the parameters of a command. This technique
258258
is useful when you are creating a proxy function, that is, a function that
259259
calls another command. This feature is introduced in Windows PowerShell 3.0.
260260

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

265-
The feature uses the `$Args` automatic variable, which contains all unassigned
265+
The feature uses the `$args` automatic variable, which contains all unassigned
266266
parameter values.
267267

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

271271
```powershell
272-
function Get-MyProcess { Get-Process @Args }
272+
function Get-MyProcess { Get-Process @args }
273273
```
274274

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

278278
```powershell
279279
Get-MyProcess -Name PowerShell
@@ -295,16 +295,16 @@ ProductVersion FileVersion FileName
295295
6.2.9200.16384 6.2.9200.1638... C:\Windows\system32\WindowsPowerShell\...
296296
```
297297

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

302302
```powershell
303303
function Get-MyCommand
304304
{
305305
Param ([switch]$P, [switch]$C)
306-
if ($P) { Get-Process @Args }
307-
if ($C) { Get-Command @Args }
306+
if ($P) { Get-Process @args }
307+
if ($C) { Get-Command @args }
308308
}
309309
310310
Get-MyCommand -P -C -Name PowerShell

reference/5.1/Microsoft.PowerShell.Management/Register-WmiEvent.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ event is raised instead of sending the event to the event queue. Enclose the com
122122
(`{}`) to create a script block.
123123

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

128128
When you specify an action, `Register-WmiEvent` returns an event job object that represents that

reference/5.1/Microsoft.PowerShell.Utility/Get-Event.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ The `Get-Event` cmdlet returns a **PSEventArgs** object
186186
automatic variable contains this value.
187187

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

192192
- SourceIdentifier. A string that identifies the event subscription. In the value of the
193193
**Action** parameter, the **SourceIdentifier** property of the `$Event` automatic variable

reference/5.1/Microsoft.PowerShell.Utility/New-Event.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ PS C:\> function Enable-ProcessCreationEvent
5959
$Identifier = "WMI.ProcessCreated"
6060
Register-ObjectEvent $ProcessWatcher "EventArrived" -SupportEvent $Identifier -Action
6161
{
62-
[void] (New-Event -SourceID "PowerShell.ProcessCreated" -Sender $Args[0] -EventArguments $Args[1].SourceEventArgs.NewEvent.TargetInstance)
62+
[void] (New-Event -SourceID "PowerShell.ProcessCreated" -Sender $args[0] -EventArguments $args[1].SourceEventArgs.NewEvent.TargetInstance)
6363
}
6464
}
6565
```

reference/5.1/Microsoft.PowerShell.Utility/Register-EngineEvent.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ instead of sending the event to the event queue. Enclose the commands in braces
160160
script block.
161161

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

reference/5.1/Microsoft.PowerShell.Utility/Register-ObjectEvent.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ raised, instead of sending the event to the event queue. Enclose the commands in
196196
create a script block.
197197

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

202202
When you specify an action, `Register-ObjectEvent` returns an event job object that represents

0 commit comments

Comments
 (0)