Instantly share code, notes, and snippets.

Embed
What would you like to do?
param (
[string]$in = $( Read-Host "Please specify a file to encode with -in" ),
[string]$out = $( Read-Host "Please specify an output file with -out" )
)
if (-Not (Test-Path $in)) { Read-Host "Please Specify a valid filepath" }
$str = [System.IO.File]::ReadAllText($in)
$bytes = [System.Text.Encoding]::Unicode.GetBytes($str)
[Convert]::ToBase64String($bytes) | Out-File $out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment