Skip to content

Instantly share code, notes, and snippets.

@luiswolff
Last active April 9, 2021 13:12
Show Gist options
  • Save luiswolff/d8b99f31be378df66ca45d1376bc1ecd to your computer and use it in GitHub Desktop.
Save luiswolff/d8b99f31be378df66ca45d1376bc1ecd to your computer and use it in GitHub Desktop.
A CMD-File, thats convert a given File to a Base64-Code and write that to an other file. The File that should be encoded is submitted as command line parameter. So you can use the drap and drop function of Windows. The output file will be the same as the input but with the string ".base64" as suffix.
@echo off
powershell -command "$bytes = [System.IO.File]::ReadAllBytes('%1'); [Convert]::ToBase64String($bytes) | Out-File -FilePath '%1.base64' -Encoding ASCII -NoNewline"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment