将 PowerShell 用于 Visual Studio 命令提示符 [英] Use PowerShell for Visual Studio Command Prompt

查看:62
本文介绍了将 PowerShell 用于 Visual Studio 命令提示符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了将我所有的命令行操作迁移到 PowerShell,我想避免使用老式的命令控制台进行任何操作.但是,Visual Studio 命令提示符具有默认命令提示符中没有的各种环境变量和路径设置.如何使用相同的设置创建Visual Studio PowerShell"?

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?

推荐答案

你可以使用例如 此脚本 导入Visual Studio命令提示符环境,参见脚本文档注释中的示例,例如对于 Visual Studio 2010:

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"' 

在 PowerShell 会话开始时(通过您的个人资料或手动)完成此操作,您将在此 PowerShell 会话中获得所需的内容.

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.

或者您可以使用 Keith Hill 在 中提供的解决方案这个答案.

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

这篇关于将 PowerShell 用于 Visual Studio 命令提示符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆