Description
This script will Base64 encode the contents of the file specified and output it to another file called {filename}.b64.
Source Code
$fileName = "File1.txt"
$fileContent = get-content $fileName
$fileContentBytes = [System.Text.Encoding]::UTF8.GetBytes($fileContent)
$fileContentEncoded = [System.Convert]::ToBase64String($fileContentBytes)
$fileContentEncoded set-content ($fileName + ".b64")
Source Code and Samples
Friday, 2 February 2007
Subscribe to:
Post Comments (Atom)
2 comments:
$fileContentEncoded | set-content ($fileName + ".b64")
it's require pipe to work
you can try this free online service to encode image to base64 string online.
Post a Comment