Concatenation Variables Problem with extra space

Welcome Forums General PowerShell Q&A Concatenation Variables Problem with extra space

This topic contains 1 reply, has 2 voices, and was last updated by

4 years, 8 months ago.

  • Author
  • #16180

    Points: 0
    Rank: Member

    The problem is I want to concatenate two variables, however I cant get rid of a space between the two.

    e.g. 1 Write-Host $_.ServerName $blah.ShareName

    output \\Server\ Share

    I have tried some variations but all fail badly!

  • #16211

    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    That's because you're using Write-Host and passing it two parameters.


    You should look into Join-Path, though. It's specifically designed for joining path components.

The topic ‘Concatenation Variables Problem with extra space’ is closed to new replies.

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