Update
ThisSo as a direct answer to your question - a PowerShell script can help with this as you have found. But this is because SlowCheetahnot a good way of controlling environment config transforms. Doing it this way requires you to create a unique build for each environment. That is inherently a Visual Studio plug inflawed way of deploying. It doesn't run on your TFS build servermeans that the code you test in DEV or UAT etc... is not the same as the code that you deploy to Production.
For environment config transforms you should be doing this in Release Manager, not as part of your build. Set up tokens that Release Manager (or whatever your release management tool is, e.g Octopus Deploy) can replace on deployment.
This is much better than having everything in build transforms, as you then only need to build once. You shouldn't have to build for each environment.