Modify variable

Welcome Forums General PowerShell Q&A Modify variable

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 7 years, 2 months ago.

  • Author
  • #5746

    Points: 0
    Rank: Member

    by leitsu at 2013-04-01 16:56:35

    How do I modify a variable. Thats say I have a variable $var = "ABC EFG". How do I check if there is a space in the variable and replace the space with "-"? $var = "ABC-EFG"

    by Nobody at 2013-04-01 19:30:32

    Use the "Replace" method

    $a = "ABC EFG"
    $a = $a.replace(" ","-")

    Lots of other string methods available too! Pipe the string to Get-Member and have a look

    "my string"|Get-Member

The topic ‘Modify variable’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort