Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何使用 powershell 比较十六进制值?
22 32 44 56 de 4f 3f
这些值在一个文件中,我需要比较它们以找到其中的最大值。这些是十六进制值。
这是一种方式:
$n = 22,32,44,56,"de","4f","3f" # or $n = get-content myfilewithHEX.txt [Convert]::ToString( ($n | % { [int]"0x$_" } | Measure-Object -Maximum).maximum , 16)
这返回de
de
另一种方式:
( $n | sort { [int]"0x$_" } ) | select -Last 1