Powershell: Convert Hex to Int type


short post today. Topic: convert a hex string to an integer type.

This can be done by a simple cast. Consider to use try/catch to handle any exceptions.

write-host "HexString:" $sMyHexValue  "HexFormatedFromInt" ([string]::Format("0x{0:x}",$iInt)) "Int:" $iInt
HexString: 0xff HexFormatedFromInt 0xff Int: 255


Advertisment to support michlstechblog.info

One thought on “Powershell: Convert Hex to Int type”

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.