Executing a Powershell Script in Fake

假如想象 提交于 2019-12-04 00:43:52

问题


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.


回答1:


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


来源:https://stackoverflow.com/questions/23351432/executing-a-powershell-script-in-fake

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!