Created
April 14, 2025 21:02
-
-
Save skarllot/9e659f9da43d7b7208f0847b2271e4a4 to your computer and use it in GitHub Desktop.
Convert binary file to base-64 using Powershell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$filePath = "C:\path\to\your\file.txt" | |
$outputPath = "C:\path\to\output\encodedFile.txt" | |
# Read the file content as bytes | |
$fileContent = [System.IO.File]::ReadAllBytes($filePath) | |
# Convert the byte array to a Base64 string | |
$base64String = [Convert]::ToBase64String($fileContent) | |
# Output the Base64 string to a new file | |
[System.IO.File]::WriteAllText($outputPath, $base64String) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment