Login Register






[Powershell] ACSII To Value & Value To String Conversions filter_list
Author
Message
[Powershell] ACSII To Value & Value To String Conversions #1
I wrote 2 different scripts in powershell to convert a string value over to Octal, Hex, and Decimal values, and vice versa.

Any help or explanation of these scripts just ask me.

ACSII_ToValue.ps1:
Code:
#Convert String Input to ACSII Value write-host "-----------------------------" -foregroundcolor "magenta" write-host " Multi ACSII Value Calculator " -foregroundcolor "magenta" write-host "-----------------------------" -foregroundcolor "magenta" write-host; write-host function StrACSII_ { $var = read-host "Enter an Octal Value or Input (Example - Powershell String)" $dec_out = [string][int[]][char[]]"$var" $data = $dec_out.split(" ") foreach ($obj in $data) { $ErrorActionPreference = "silentlycontinue" $hex_out += [Convert]::ToString($obj, 16); $hex_out += " " $oct_out += [Convert]::ToString($obj, 8); $oct_out += " " } write-host write-host "[Input Value: $var]" write-host write-host "Decimal Value: " -foregroundcolor "magenta" -nonewline; write-host $dec_out -foregroundcolor "cyan" write-host "Octal Value: " -foregroundcolor "magenta" -nonewline; write-host $oct_out -foregroundcolor "cyan" write-host "Hex Value: " -foregroundcolor "magenta" -nonewline; write-host $hex_out -foregroundcolor "cyan" write-host "HTML Value: " -foregroundcolor "magenta" -nonewline; write-host "(Note: Same as Hex output)" -foregroundcolor "cyan" write-host clear-variable -name dec_out, oct_out, hex_out StrACSII_ } StrACSII_

ACSII_ToString.ps1:
Code:
#Convert ACSII Input to String Value write-host "-----------------------------" -foregroundcolor "magenta" write-host " Multi ACSII Char Calculator " -foregroundcolor "magenta" write-host "-----------------------------" -foregroundcolor "magenta" write-host; write-host function ACSII_ { $var = read-host "Enter an Octal Value or Input (Example - 140 150 126 138)" $data = $var.split(" ") foreach ($obj in $data) { $ErrorActionPreference = "silentlycontinue" $str_dec += [char][int]"$obj" $oct = [Convert]::ToInt32($obj, 8) $str_oct += [char][int]"$oct" $hex = [Convert]::ToInt32($obj, 16) $str_hex += [char][int]"$hex" } write-host write-host "[Input Value: $var]" write-host write-host "Decimal Value: " -foregroundcolor "magenta" -nonewline; write-host $str_dec -foregroundcolor "cyan" write-host "Octal Value: " -foregroundcolor "magenta" -nonewline; write-host $str_oct -foregroundcolor "cyan" write-host "Hex Value: " -foregroundcolor "magenta" -nonewline; write-host $str_hex -foregroundcolor "cyan" write-host "HTML Value: " -foregroundcolor "magenta" -nonewline; write-host "(Note: Same as Hex output)" -foregroundcolor "cyan" write-host clear-variable -name str_oct, str_dec, str_hex ACSII_ } ACSII_
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply