< Back

ConvertFrom-CBase64

Sun Jan 12, 2020 9:04 pm

NAME ConvertFrom-CBase64



SYNOPSIS

Converts a base-64 encoded string back into its original string.





SYNTAX

ConvertFrom-CBase64 [-Value] <String[]> [[-Encoding] <Encoding>] [<CommonParameters>]





DESCRIPTION

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.





PARAMETERS

-Value <String[]>

The base-64 string to convert.



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Encoding <Encoding>

The encoding to use. Default is Unicode.



Required? false

Position? 2

Default value ([Text.Encoding]::Unicode)

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>ConvertFrom-CBase64 -Value 'RW5jb2RlIG1lLCBwbGVhc2Uh'



Decodes `RW5jb2RlIG1lLCBwbGVhc2Uh` back into its original string.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>ConvertFrom-CBase64 -Value 'RW5jb2RlIG1lLCBwbGVhc2Uh' -Encoding ([Text.Encoding]::ASCII)



Shows how to specify a custom encoding in case your string isn't in Unicode text encoding.









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>'RW5jb2RlIG1lIQ==' | ConvertTo-CBase64



Shows how you can pipeline input into `ConvertFrom-CBase64`.











RELATED LINKS

ConvertTo-CBase64