[英]powershell version number compare
I need to compare 2 version numbers.我需要比较 2 个版本号。
$version = '1.9.0'
$shareversion = Get-Content -Path \\Network-Share\some_file.txt
some_file.txt file has only the value 1.1.0
some_file.txt 文件只有值1.1.0
[Version]$version -lt [Version]$shareversion
Output is True Output 为真
Did you checked the value of $shareversion
?你检查过$shareversion
的值吗? Must be something wrong with your file or path because when you hardcode the $shareversion
the output is False
- as expected:您的文件或路径一定有问题,因为当您对$shareversion
进行硬编码时,output 为False
- 正如预期的那样:
$version = '1.9.0'
$shareversion = '1.1.0'
[Version]$version -lt [Version]$shareversion
Output: Output:
False
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.