Grab our RSS feeds Follow us on Twitter Join our Facebook Group Connect with us on LinkedIn
myITforum.com, Powered by You.
you are not logged in

Articles

Newslinks

Links

Downloads

Site Services

Community Forums

Discussion Lists

Article Search

Newsletter

Web Blogs

FAQs

Live Support

myITforum TV

Take a Poll

Monthly Drawing

myITforum Network

User Group Directory

Our Partners

About Us

Register

Login

BRONZE PARTNER:

BRONZE PARTNER:



Industry News:




  Home : Articles : Windows PowerShell print | email | | Forums |   print | email | | Blogs |   print | email | | Wiki |   print | email | | FAQs |   print | email | Article Search  
PowerShell script to convert decimal number to hexadecimal value


Bookmark and Share

By: Ying Li
Posted On: 8/13/2007

Here is a little PS script to convert a decimal number to hexadecimal value.

This article was Previously posted on Ying Li's Blog

I use an inputbox function to get the input (It’s a string), convert it to Integer and then use the .NET formatting method to convert the integer to its hexadeicmal counterpart.

$a = new-object -comobject MSScriptControl.ScriptControl
$a.language = "vbscript"
$a.addcode("function getInput() getInput = inputbox(`"Enter The Decimal Number`",`"Convert Decimal Number to Hexadecimal Value`") end function" )
$b = $a.eval("getInput")
$c = [int] $b
$c = "{0:X}" -f $c
Write-host "The Hexadecimal value is: " $c



  myITforum.com ©2010 | Legal | Privacy