Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Fake中执行Powershell脚本_Powershell_F#_F# Fake - Fatal编程技术网

在Fake中执行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脚本的最佳方式是什么


我觉得这个问题应该有一个明显的答案,但我们无法通过搜索找到任何东西。

正如您在评论中提到的,使用
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-不考虑显而易见的事情!