To Hex and Back (The Journey of an Integer)
This is so simple and I forget it every time. This time I am blogging it! (I apologize if the title has been taken before.)
From HEX to Integer
Start Value: 124f80
To convert to Integer we just add 0x and Powershell will do the rest
0x124f80
1200000
1200000
From Integer to Hex
Start Value: 1234567
To Convert to HEX we can use the -f operator
"{0:x}" -f 1234567
12d687
12d687
UPDATE!
Oisin pointed out these options as well
PS: (4545).tostring("x")
11c1
11c1
# or
PS: $n = 4545; $n.tostring("X")
11C1
tshell :: Feb.19.2008 :: All, HowTo, Powershell, Scripting :: 1 Comment »


also…
PS# (4545).tostring(\”x\”)
11c1
or
PS# $n = 4545; $n.tostring(\”X\”)
11C1