Executing a Powershell Script in Fake

2019-02-16 17:07发布

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条回答
\"骚年 ilove
2楼-- · 2019-02-16 17:18

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")
查看更多
登录 后发表回答