Converting radix in PowerShell

Convert a string to a specified radix string

# Hexadecimal -> Binary
PS> [convert]::ToString(0xFF,2)
11111111
PS> [convert]::ToString("0xFF",2)
11111111
# Hexadecimal -> Decimal
PS> [convert]::ToString(0xFF,10)
255
PS> [convert]::ToString("0xFF",10)
255
# Decimal -> Hexadecimal
PS> [convert]::ToString(255,16)
ff
PS> [convert]::ToString("255",16)
ff
# Decimal -> Hexadecimal (Example using the -f operator)
PS> '{0:x}' -f 255
ff
PS> '{0:X}' -f 255
FF
# Decimal -> Binary
PS> [convert]::ToString(255,2)
11111111
PS> [convert]::ToString("255",2)
11111111

Conversion from unprefixed string to int

If no prefix (such as “0x” or “0b”).

# Hexadecimal -> Decimal
PS> [Convert]::ToInt32("FF",16)
255

# Binary -> Decimal
PS> [Convert]::ToInt32("11111111",2)
255