Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.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
Powershell:引用某个文件夹中包含的所有脚本_Powershell - Fatal编程技术网

Powershell:引用某个文件夹中包含的所有脚本

Powershell:引用某个文件夹中包含的所有脚本,powershell,Powershell,是否可以在Powershell中引用某个文件夹中包含的所有脚本?比如: ."$PSScriptRoot\helpers\*.ps1" 我正在使用以下方法动态创建类型: New-Object -TypeName "$($fixture)Runner"; 我真的想通过设置“helpers”文件夹下的所有类型来加强约定而不是配置 可能吗 如果我使用星号作为一种正则表达式,则Powershell无法找到我尝试实例化的类型。要引用文件中的代码,可以“点源”它们: Get-ChildItem "$PSS

是否可以在Powershell中引用某个文件夹中包含的所有脚本?比如:

."$PSScriptRoot\helpers\*.ps1"
我正在使用以下方法动态创建类型:

New-Object -TypeName "$($fixture)Runner";
我真的想通过设置“helpers”文件夹下的所有类型来加强约定而不是配置

可能吗


如果我使用星号作为一种正则表达式,则Powershell无法找到我尝试实例化的类型。

要引用文件中的代码,可以“点源”它们:

Get-ChildItem "$PSScriptRoot\helpers\*.ps1" | ForEach-Object{. $_.FullName}