PowerShell

Special Operators

Array Expression Operator

Returns the expression as an array.

@(Get-ChildItem $env:windir\System32\ntdll.dll)

Will return an array with one item

@(Get-ChildItem $env:windir\System32)

Will return an array with all the items in the folder (which is not a change of behavior from the inner expression.

Call Operation

$command = 'Get-ChildItem'
& $Command

Will execute Get-ChildItem

Dot sourcing operator

. .\myScript.ps1

runs .\myScript.ps1 in the current scope making any functions, and variable available in the current scope.


This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow