如何从Visual Studio 2010运行PowerShell脚本 [英] How do I run a PowerShell script from Visual Studio 2010
本文介绍了如何从Visual Studio 2010运行PowerShell脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我在Visual Studio中有一个.ps文件,该如何在项目上下文中运行它?
If I have a .ps file in Visual Studio, how do I go about running it within the context of the project?
推荐答案
不确定从项目上下文中"到底是什么意思,但是您可以:
Not sure what exactly you mean by "from within the context of the project" but you can:
-
创建一个
Process
Process p = new Process();
然后将进程的命令设置为:
Then set the command of the process to be:
powershell.exe YourScriptName.ps1
如果您只需要运行脚本,则可以使用此功能.
This works if you just need to run the script.
这篇关于如何从Visual Studio 2010运行PowerShell脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文