I want to know the brief information about the following keywords, use in PowerShell
1. @();
2. -contains
3. -like
4. -join
I want to know the brief information about the following keywords, use in PowerShell
1. @();
2. -contains
3. -like
4. -join
You can find the answers in the following help topics:
PS> help about_*Operators*
You should read the help as Shay Levy suggested, and also show us that you've tried to find this yourself before asking. To summarize:
@()
is used to create an array. Arrays are automatically created when you seperate multiple values with commas. However, if you need to ensure that your result is always an array (even with only one value), you could wrap @()
around it. Examples:
@(Get-ChildItem) #Ensure array-result
@() #Empty array
@("hello") #Array with one member
-contains
is used to check if a specific value is inside an array.
$mylist -contains "this value"
-like
searches for ex. text inside a string, and allows wildcards. It works the same as LIKE
in SQL.
"my long text" -like "my*"
-join
is used to join an array into a single object. Ex. a string-array into a string.
"hello", "world" -join " "