且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从Visual Studio 2010运行PowerShell脚本

更新时间:2023-02-03 20:53:06

不确定从项目上下文中"到底是什么意思,但是您可以:

Not sure what exactly you mean by "from within the context of the project" but you can:

  1. 创建一个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.