How to call batch script from Powershell?

If you grab the PowerShell Community Extensions, there is an Invoke-BatchFile command in it that runs the batch file but more importantly, it retains any environment variable modifications made by the batch file e.g.:

>Invoke-BatchFile 'C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat'
Setting environment for using Microsoft Visual Studio 2008 x86 tools.

Leave a Comment