Rob van der Woude's Scripting Pages

Batch How To ...

Base64 Encode and Decode Files

 

Using native CERTUTIL

CERTUTIL is native in Windows 8 .. 11 (not sure about Vista and 7).

Encode:

CERTUTIL.EXE -encode myfile.org myfile.b64
Credits: Christopher Heng's article "How to Embed a Background Image in CSS to Get a Self-Contained Web Page".
Note: If you intend to use the encoded file for embedding images in HTML, you may want to remove the first and last line of myfile.b64 ("-----BEGIN CERTIFICATE-----" and "-----END CERTIFICATE-----")

Decode:

CERTUTIL.EXE -decode myfile.b64 myfile.org

 

Using third party B64

B64 by Bob Trower is a third party open source implementation of a base64 encoder/decoder.

Encode:

B64.EXE -e myfile.org myfile.b64
Note: B64's optional -l switch allows you to modify the line length of the encoded file, which may be useful to create a single-line file.

Decode:

B64.EXE -d myfile.b64 myfile.org

page last modified: 2023-07-01; loaded in 0.0070 seconds