0
$content = Get-Content("d:\gfile.txt")
$content = $content.Replace("sometext", "replacedtext")
$content | Out-File "d:\newfile.txt"

This works for me - really good - I can convert SQL files to this. Using Read-Host I can store the new database info in a variable for the global varible settings in the script.

What I need to work out is - how can I do this for multiple strings in the same variable without running this for each replacement string?

Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
Royston
  • 433
  • 2
  • 9
  • 25
  • Not sure I understand your question... can you clarify? Probably worth including some sample input and desired output. Ta! – gvee Mar 20 '17 at 11:57
  • The thing is, i see multiple posts for use of -Replace - How do you input or replace entire large chunks of elements in XML though, i.e. starting with < Massive section /> – Royston Mar 27 '17 at 13:08
  • That still doesn't clarify things. Perhaps a proper example with inputs and desired outputs would help illustrate your problem. – gvee Mar 27 '17 at 15:58

0 Answers0