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
@@ -1,7 +1,7 @@
---
description: Describes how to use splatting to pass parameters to commands in PowerShell.
Locale: en-US
ms.date: 01/18/2026
ms.date: 06/17/2026
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_splatting?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about_Splatting
Expand Down Expand Up @@ -112,6 +112,47 @@ $ArrayArguments = "test.txt", "test2.txt"
Copy-Item @ArrayArguments -WhatIf
```

A jagged array is an array that contains other arrays. PowerShell handles
splatting of jagged arrays for native commands differently than for PowerShell
commands.

For example, the following command splats a jagged array to a PowerShell
script.

```powershell
$arguments = 1, (2, 3), 4
D:\temp\testargs.ps1 @arguments
```

The script receives three arguments, the second of which is an array.

```Output
3 argument(s) received (enclosed in <...> for delineation):

<1>
<2 3>
<4>
```

In this example, the jagged array is splatted to a native command.

```powershell
$arguments = 1, (2, 3), 4
echoargs.exe @arguments
```

The native command receives four arguments, the second and third items are
the elements of the inner array.

```Output
4 argument(s) received (enclosed in <...> for delineation):

<1>
<2>
<3>
<4>
```

### Using the ArgumentList parameter

Several cmdlets have an **ArgumentList** parameter that is used to pass
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Describes how to use splatting to pass parameters to commands in PowerShell.
Locale: en-US
ms.date: 01/18/2026
ms.date: 06/17/2026
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_splatting?view=powershell-7.4&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about_Splatting
Expand Down Expand Up @@ -115,6 +115,47 @@ $ArrayArguments = "test.txt", "test2.txt"
Copy-Item @ArrayArguments -WhatIf
```

A jagged array is an array that contains other arrays. PowerShell handles
splatting of jagged arrays for native commands differently than for PowerShell
commands.

For example, the following command splats a jagged array to a PowerShell
script.

```powershell
$arguments = 1, (2, 3), 4
D:\temp\testargs.ps1 @arguments
```

The script receives three arguments, the second of which is an array.

```Output
3 argument(s) received (enclosed in <...> for delineation):

<1>
<2 3>
<4>
```

In this example, the jagged array is splatted to a native command.

```powershell
$arguments = 1, (2, 3), 4
echoargs.exe @arguments
```

The native command receives four arguments, the second and third items are
the elements of the inner array.

```Output
4 argument(s) received (enclosed in <...> for delineation):

<1>
<2>
<3>
<4>
```

### Using the ArgumentList parameter

Several cmdlets have an **ArgumentList** parameter that is used to pass
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Describes how to use splatting to pass parameters to commands in PowerShell.
Locale: en-US
ms.date: 01/18/2026
ms.date: 06/17/2026
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_splatting?view=powershell-7.5&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about_Splatting
Expand Down Expand Up @@ -115,6 +115,47 @@ $ArrayArguments = "test.txt", "test2.txt"
Copy-Item @ArrayArguments -WhatIf
```

A jagged array is an array that contains other arrays. PowerShell handles
splatting of jagged arrays for native commands differently than for PowerShell
commands.

For example, the following command splats a jagged array to a PowerShell
script.

```powershell
$arguments = 1, (2, 3), 4
D:\temp\testargs.ps1 @arguments
```

The script receives three arguments, the second of which is an array.

```Output
3 argument(s) received (enclosed in <...> for delineation):

<1>
<2 3>
<4>
```

In this example, the jagged array is splatted to a native command.

```powershell
$arguments = 1, (2, 3), 4
echoargs.exe @arguments
```

The native command receives four arguments, the second and third items are
the elements of the inner array.

```Output
4 argument(s) received (enclosed in <...> for delineation):

<1>
<2>
<3>
<4>
```

### Using the ArgumentList parameter

Several cmdlets have an **ArgumentList** parameter that is used to pass
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Describes how to use splatting to pass parameters to commands in PowerShell.
Locale: en-US
ms.date: 01/18/2026
ms.date: 06/17/2026
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_splatting?view=powershell-7.6&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about_Splatting
Expand Down Expand Up @@ -115,6 +115,47 @@ $ArrayArguments = "test.txt", "test2.txt"
Copy-Item @ArrayArguments -WhatIf
```

A jagged array is an array that contains other arrays. PowerShell handles
splatting of jagged arrays for native commands differently than for PowerShell
commands.

For example, the following command splats a jagged array to a PowerShell
script.

```powershell
$arguments = 1, (2, 3), 4
D:\temp\testargs.ps1 @arguments
```

The script receives three arguments, the second of which is an array.

```Output
3 argument(s) received (enclosed in <...> for delineation):

<1>
<2 3>
<4>
```

In this example, the jagged array is splatted to a native command.

```powershell
$arguments = 1, (2, 3), 4
echoargs.exe @arguments
```

The native command receives four arguments, the second and third items are
the elements of the inner array.

```Output
4 argument(s) received (enclosed in <...> for delineation):

<1>
<2>
<3>
<4>
```

### Using the ArgumentList parameter

Several cmdlets have an **ArgumentList** parameter that is used to pass
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Describes how to use splatting to pass parameters to commands in PowerShell.
Locale: en-US
ms.date: 01/18/2026
ms.date: 06/17/2026
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_splatting?view=powershell-7.7&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about_Splatting
Expand Down Expand Up @@ -52,7 +52,7 @@ defining a parameter in a command.
## Splatting with hash tables

Use a hash table to splat parameter name and value pairs. You can use this
format for all parameter types, including positional and switch parameters.
format for all parameter types, including positional and `[switch]` parameters.
Positional parameters must be assigned by name.

The following examples compare two `Copy-Item` commands that copy the Test.txt
Expand All @@ -71,7 +71,7 @@ table of parameter-name and parameter-value pairs and stores it in the
variable in a command with splatting. The At symbol (`@HashArguments`) replaces
the dollar sign (`$HashArguments`) in the command.

To provide a value for the **WhatIf** switch parameter, use `$true` or
To provide a value for the **WhatIf** `[switch]` parameter, use `$true` or
`$false`.

```powershell
Expand Down Expand Up @@ -115,6 +115,47 @@ $ArrayArguments = "test.txt", "test2.txt"
Copy-Item @ArrayArguments -WhatIf
```

A jagged array is an array that contains other arrays. PowerShell handles
splatting of jagged arrays for native commands differently than for PowerShell
commands.

For example, the following command splats a jagged array to a PowerShell
script.

```powershell
$arguments = 1, (2, 3), 4
D:\temp\testargs.ps1 @arguments
```

The script receives three arguments, the second of which is an array.

```Output
3 argument(s) received (enclosed in <...> for delineation):

<1>
<2 3>
<4>
```

In this example, the jagged array is splatted to a native command.

```powershell
$arguments = 1, (2, 3), 4
echoargs.exe @arguments
```

The native command receives four arguments, the second and third items are
the elements of the inner array.

```Output
4 argument(s) received (enclosed in <...> for delineation):

<1>
<2>
<3>
<4>
```

### Using the ArgumentList parameter

Several cmdlets have an **ArgumentList** parameter that is used to pass
Expand Down