PowerShell – Delete String Containing Brackets

email me

String you want to delete: [SERVER:8888],Timeout=10

$Path = "C:\PowerShell\test.txt"

# string that contains brackets
$String = "<Value>\[SERVER:8888\],Timeout=10</Value>"

(Get-Content $Path) | 
Foreach-Object {$_ -replace "$String", ""} | 
Set-Content $Path