PowerShell: remove or replace quote marks from variable

后端 未结 6 1046
栀梦
栀梦 2021-02-19 02:24

I\'m using Get-EventLog to set a variable, and then setting another variable with the event ID description. I then use blat.exe to email this information to a group.

Th

6条回答
  •  庸人自扰
    2021-02-19 02:56

    None of the above answers worked for me. So I created the following solution...

    Search and Replace the character single Quote "'" ascii Character (39) with a space " " ascii Character (32)

    $strOldText = [char] 39
    $strNewText = [char] 32
    
    $Variable. = $Variable..Replace($strOldText, $strNewText).Trim()
    

提交回复
热议问题