Can I replace a line containing parenthesis and quotation marks with -replace in powershell

Viewed 38

I have the below powershell file and need to replace multiple commands. Is it possible to replace the text containing parenthesis and quotation marks with the -replace command?

 $original_file = 'D:\Prtr\tr.lst'
 $destination_file =  'D:\Prtr\pr.iso'
 (gc $original_file -raw) | ForEach-Object {
 $_ -replace 'TL_FORCE(11,"PRX",0,100)', '$(FREE_LQQ)(1,2)' `
 -replace 'TL_FORCE(11,"PRX",0,200)', '$(FREE_LQQ)(2,2)' `
 -replace 'TL_FORCE(11,"PRX",0,200)', '$(FREE_LQQ)(3,2)' `
 } | Set-Content $destination_file

The way I have it currently written doesn't replace anything. I tried using a double backslash to isolate the quotation marks but without success.

0 Answers
Related