2016-05-20 6 views
-1

Ich sehe oft die Verwendung von @ Symbol in Powershell-Codierung. Willst du fragen, wofür es gebraucht wird? Beispiel wie untenVerwendung von @ in Powershell

$DistributionPointGroups = @("London") 

Antwort

1

@() der Array-Operator ist, die dafür sorgt, dass auch nur ein einziges Element (oder Null) als Array zurückgeführt wird.

der Array Unterausdruck OPERATOR

Der Array Unterausdruck Operator einen Array erzeugt, auch wenn es enthält null oder ein Objekt.

The syntax of the array operator is as follows: 
    @(...) 

You can use the array operator to create an array of zero or 
one object. 

    PS C:\>$a = @("One") 
    PS C:\>$a.Count 
    1 

    PS C:\>$b = @() 
    PS C:\>$b.Count 
    0 

Quelle: about_Arrays

Verwandte Themen