-4

I want to know the brief information about the following keywords, use in PowerShell

 1. @();
 2. -contains
 3. -like
 4. -join
daniyalahmad
  • 3,513
  • 8
  • 29
  • 52
  • for `@` symbol, you can check http://stackoverflow.com/questions/363884/what-does-the-symbol-do-in-powershell – poiu2000 Dec 01 '13 at 07:22
  • 2
    Have you read any of the documentation freely available about PowerShell? Start with [get-help about_operators](http://technet.microsoft.com/en-us/library/hh847732.aspx). – alroc Dec 01 '13 at 12:46

2 Answers2

4

You can find the answers in the following help topics:

PS> help about_*Operators*
Shay Levy
  • 121,444
  • 32
  • 184
  • 206
1

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 " "
Frode F.
  • 52,376
  • 9
  • 98
  • 114