gpt4 book ai didi

function - 通过字符串在PowerShell中调用函数

转载 作者:行者123 更新时间:2023-12-03 13:18:25 25 4
gpt4 key购买 nike

我正在尝试使用字符串“动态”调用Powershell函数。例

$functionToInvoke = "MyFunctionName";

Invoke-Function $functionToInvoke $arg1 $arg2 # <- what I would like to do

有什么办法可以使用PowerShell 2.0来实现?

最佳答案

你可以这样做:

 &"MyFunctionName" $arg1 $arg2

关于function - 通过字符串在PowerShell中调用函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6847923/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com