我正在尝试在 Powershell中使用此元数据提取器 dll 。我以前在 Powershell 中使用过 .net dll,但我就是无法正常工作。
$assembly = [reflection.assembly]::loadfile( "$PSScriptRoot\MetadataExtractor.dll")
#$directory = New-Object -TypeName ImageMetadataReader
#$directory = New-Object ImageMetadataReader::ReadMetadata -ArgumentList $path
#$directory = New-Object -TypeName [ImageMetadataReader]::ReadMetadata -ArgumentList $path
无论我如何尝试调用 dll,我得到的只是一些版本
ImageMetadataReader.ReadMetadata:术语“ImageMetadataReader.ReadMetadata”未被识别为 cmdlet、函数、脚本文件或可运行程序的名称。
该 dll 甚至有一些Powershell 功能,但尝试使用它我得到了这个结果:
import-module "C:\path\to\MetadataExtractor.dll"
get-module
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Binary 2.4.1.0 MetadataExtractor
如您所见,该ExportedCommands
部分是空的,并且尝试运行 cmdlet(从我认为应该调用它的源代码Extract-Metadata
)也不起作用。
提取元数据:术语“提取元数据”不能识别为 cmdlet、函数、脚本文件或可运行程序的名称。
如何从 Powershell 调用此 dll 中的方法?