Executing a Powershell Script in Fake

后端 未结 1 1688
你的背包
你的背包 2021-01-12 00:57

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, bu

相关标签:
1条回答
  • 2021-01-12 01:30

    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")
    
    0 讨论(0)
提交回复
热议问题