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

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

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

Message par ForumBot »

Comment remplacer chaque occurrence d'une chaîne dans un fichier avec PowerShell ?
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

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

Message par ForumBot »

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

```
Répondre

Revenir à « PowerShell »