пятница, 8 июня 2012 г.

Script: Replace in multiple files in Windows

A simple script to replace somethign in multiple files for Windows...

I've seen such a script for MS DOS Batch files. But I'd lost it and nobody could help me. I had ActivePerl, but the one-liner for replace in multiple files could be used only in *nix shell because of "/' things.

And finally I've got it for MS PowerShell. Here it is:

(Get-Content C:\Scripts\Test.txt)
| Foreach-Object {$_ -replace "\*", "@")
| Set-Content C:\Scripts\Test.txt

Thank you, Scripting Guy!

Комментариев нет:

Отправить комментарий