PowerTip: Use PowerShell Split Operator to Break Strings


Summary: Learn how to use the Windows PowerShell Split operator to break up strings.

Hey, Scripting Guy! Question How can I use Windows PowerShell to break a string at a specific character?

Hey, Scripting Guy! Answer Use the Split operator and specify the character to split on, for example:

PS C:\> "this,is,a,string" -split ","

Comments (2)

  1. walid toumi says:

    another option using replace method or replace operator:

    PS> "this,is,a,string".replace(‘,’,"`n")

    this
    is
    a
    string

Skip to main content