我正在阅读两个 MS Word 文件,需要比较 docx 属性。
我得到每个变量的正确输出,但是一旦我比较它们,它就会抛出以下错误。
知道为什么吗?
Major Minor Build Revision
----- ----- ----- --------
1 0 -1 -1
1 1 -1 -1
无法将“1.0”与“1.1”进行比较。错误:“无法将“System.Object[]”类型的“System.Object[]”值转换为“System.Version”类型。” 在 C:\Users\Sebastian\Documents\IT Projects\Saberwal\Groups - Advanced.ps1:76 char:6 + if ($CurrentVersion -lt $NewVersion) {Write-Output "New is Greater"} + ~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : ComparisonFailure
代码:
$CurrentVersion = Check-Version $CurrentSignaturePath $CurrentSignatureFile
$NewVersion = Check-Version $NewSignaturePath $NewSignatureFile
Write-Output $CurrentVersion
Write-Output $NewVersion
if ($CurrentVersion -lt $NewVersion) { Write-Output "New is bigger" }