I have a .txt file in which I want to replace the string aaa with bbb.
I have tried the following PowerShell code:
Get-Content c:\1.txt | ForEach-Object { $_ -replace "aaa", "bbb" } | Set-Content c:\1.txt
I get an error that 1.txt is being used by another process. What am I doing wrong?