PowerShell :: Convert a binary file to Base64
So occasionally I have need to encode files to Base64 and if those files are not simple text then it needs to be done at a binary level. This simple script in PowerShell does that for you, you simply set the $inputFilePath and $ouputFilePath then execute. It outputs to a file as the output string gets large very quickly.
$inputFilePath = "C:\input.file" $outputFilePath = "C:\output.txt" [System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes($inputFilePath)) > $outputFilePath
This script is designed in tandem with PowerShell :: Convert Base64 to a binary file.