windowsvisual-studiowindows-7powershell

Use PowerShell for Visual Studio Command Prompt


In a serious intiative to migrate all my command line operations to PowerShell, I would like to avoid using the old fashioned command console for anything. However, the Visual Studio Command prompt has various environment variables and path settings not found in the default command prompt. How could I create a 'Visual Studio PowerShell' with those same settings?


Solution

  • You can use for example this script to import Visual Studio command prompt environment, see the examples in the script documentation comments, e.g. for Visual Studio 2010:

    Invoke-Environment '"%VS100COMNTOOLS%\vsvars32.bat"' 
    

    Having done that in the beginning of a PowerShell session (from your profile or manually), you get what you ask for in this PowerShell session.

    Or you can use the solution provided by Keith Hill in this answer.