Converts a base-64 encoded string back into its original string.
ConvertFrom-Base64 [-Value] <String[]> [[-Encoding] <Encoding>] [<CommonParameters>]
For some reason. .NET makes encoding a string a two-step process. This function makes it a one-step process.
You're actually allowed to pass in $null
and an empty string. If you do, you'll get $null
and an empty string back.
Name | Type | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
Value | String[] | The base-64 string to convert. |
true | true (ByValue) | |
Encoding | Encoding | The encoding to use. Default is Unicode. |
false | false | ([Text.Encoding]::Unicode) |
ConvertFrom-Base64 -Value 'RW5jb2RlIG1lLCBwbGVhc2Uh'
Decodes RW5jb2RlIG1lLCBwbGVhc2Uh
back into its original string.
ConvertFrom-Base64 -Value 'RW5jb2RlIG1lLCBwbGVhc2Uh' -Encoding ([Text.Encoding]::ASCII)
Shows how to specify a custom encoding in case your string isn't in Unicode text encoding.
'RW5jb2RlIG1lIQ==' | ConvertTo-Base64
Shows how you can pipeline input into ConvertFrom-Base64
.