powershell-tricks
  • Introduction
  • Run Remote Script from Host
  • Expand Array as Parameter
  • Output a Hashtable
  • Use Add-Type without Pollute Current Session
  • Get-Location is the execution path.
  • About Dot Sourcing
  • About ScriptBlock
Powered by GitBook
On this page

Expand Array as Parameter

Use the magic character `@`.

Function Test($a, $b, $c){
    Write-Host $a
    Write-Host $b
    Write-Host $c
}

$arr = @(1,2,3)

When you run Test $arr, you will get

1 2 3

When you run Test @arr, you will get

1
2
3
PreviousRun Remote Script from HostNextOutput a Hashtable

Last updated 7 years ago