在Fake中执行Powershell脚本
在假构建自动化工具中执行Powershell脚本的最佳方式是什么在Fake中执行Powershell脚本,powershell,f#,f#-fake,Powershell,F#,F# Fake,在假构建自动化工具中执行Powershell脚本的最佳方式是什么 我觉得这个问题应该有一个明显的答案,但我们无法通过搜索找到任何东西。正如您在评论中提到的,使用PowerShell类使这非常容易 #r "FakeLib.dll" #r "System.Management.Automation" open Fake open System.Management.Automation Target "RunSomePowerShell" <| fun _ -> PowerS
我觉得这个问题应该有一个明显的答案,但我们无法通过搜索找到任何东西。正如您在评论中提到的,使用
PowerShell
类使这非常容易
#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")
#r“FakeLib.dll”
#r“系统、管理、自动化”
开假
开放系统、管理、自动化
目标“RunSomePowerShell”
PowerShell.Create()
.AddScript(“(获取进程|?进程名-eq'chrome'|度量工作集-Average).Average”)
.Invoke()
|>序号iter(打印编号“%O”)
Fake是一个F#工具,所以我想您可以使用Process类。听起来像它,或者使用Powershell主机类(请参见链接)。我是F#noob-不考虑显而易见的事情!