ls -recurse -Include *.csproj | % {sp $_ isreadonly $false; (Get-Content $_) -replace "here","there" | Set-Content -Path $_}A few comments to make:
% is an alias for foreach-object
sp is an alias fro Set-ItemProperty
-replace allows using regular expressions
The only downside was that I still had to check in the projects back into TFS manually, for some reason the TFS powertools would not allow me to checkout more than 2 projects at the same time, but on the plus side this is a good equivalent to Sed in PowerShell.
Thanks, loved this. Learning Powershell equivalents to Unix stuff has been challenging.
ReplyDelete