Author Topic: Easy Base64 conversion  (Read 2799 times)

sveakul

  • Hero Member
  • *****
  • Posts: 1909
You can easily encode a file into Base64 text with Window's built-in (post-XP) certutil.exe utility.  Copy/paste the following code into an empty .txt text file, rename it with a .bat extension like "Base64encode.bat", then put the bat file into your Windows "SendTo" folder.  The latter is normally located at ..\Users\(username)\Appdata\Roaming\Microsoft\Windows\SendTo.

Code
@echo off
echo The file will be encoded to Base64 txt
pause
certutil -encode %1 %1.txt
pause
Then, to encode a file into its Base64 text string, right-click the file and select the bat you made from the SendTo context menu.  A file will be created in the same folder as the original named with the original filename and a .txt extension, like "artwork.jpg.txt."  The original file will be kept.  Opening the .txt file and copying everything BETWEEN the "---BEGIN CERTIFICATE---" and "---END CERTIFICATE---" lines will allow you to paste the original file's Base64 equivalent anywhere you want.  I use this method now when adding custom images to MusicBee skins' "NoArtwork" display element (https://getmusicbee.com/forum/index.php?topic=22889.0).
Last Edit: August 27, 2018, 08:02:21 PM by sveakul