本文介绍了在Fake中执行Powershell脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Fake构建自动化工具中执行Powershell脚本的最佳方法是什么?
What is the best way to go about executing a Powershell script in the Fake build automation tool ?
我认为该问题应该有一个明显的答案,但无法通过搜索找到任何东西.
I feel that there should be an obvious answer to this question, but have not been able to find anything by searching.
推荐答案
正如您在评论中提到的那样,使用PowerShell
类使此操作非常容易.
As you mention in your comment, using the PowerShell
class makes this very easy.
#r "FakeLib.dll"
#r "System.Management.Automation"
open Fake
open System.Management.Automation
Target "RunSomePowerShell" <| fun _ ->
PowerShell.Create()
.AddScript("(Get-Process | ? ProcessName -eq 'chrome' | measure WorkingSet -Average).Average")
.Invoke()
|> Seq.iter (printfn "%O")
这篇关于在Fake中执行Powershell脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!