标签: powershell mac-address
我有一个mac地址作为字符串,格式如下:xx:xx:xx:xx:xx:xx(六组两个十六进制数字,用冒号分隔)。
xx:xx:xx:xx:xx:xx
我想将字符串转换为它的相应十六进制值(作为System.Byte类型)。
System.Byte
我该如何转换它?
答案 0 :(得分:2)
此?
"00:0a:fe:25:af:db" -split ':' | % { [byte]"0x$_" }
评论后编辑:
[UInt64] "0x$("00:0a:fe:25:af:db" -replace ':')"