Convert base64 string to file Convert base64 string to file powershell powershell

Convert base64 string to file


The FromBase64String() method converts a base64-encoded string to a byte array. All you need to do is write that byte array back to a file:

$b64      = 'AAAAAA...'$filename = 'C:\path\to\file'$bytes = [Convert]::FromBase64String($b64)[IO.File]::WriteAllBytes($filename, $bytes)