2024-11-06

PowerShell UTF-8 to Base64 Encode / Decode

[string]$StringToEncode="編碼的字串"
$EncodedString=[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($StringToEncode))
write-host "Encoded String:" $EncodedString

$DecodedString=[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($EncodedString))
write-host "Decoded String:" $DecodedString

沒有留言:

張貼留言