Comment remplacer chaque occurrence d'une chaîne dans un fichier avec PowerShell ?

Comment remplacer chaque occurrence d’une chaîne dans un fichier avec PowerShell ?

Utilisez (version V3) :

(Get-Content c:\temp\test.txt).Replace('[MYID]', 'MyValue') | Set-Content c:\temp\test.txt

Ou pour V2 :

(Get-Content c:\temp\test.txt) -replace '\[MYID\]', 'MyValue' | Set-Content c:\temp\test.txt