You are not logged in.
Pages: 1
Is there a way using a batch script to copy the binary from one file and type it into a temp file then when the user calls the temp file from the batch script it inputs it into a file to recreate the original file ? Thanks
Offline
certutil can be used in Modern Windows to encode a binary to a text representation and also back into the same binary file.
This script will make the part that you can put into your batch file - and that part recreates the binary file.
@echo off
if "%~1"=="" echo Syntax: "%~0" "file to be encoded.ext" & pause & goto :EOF
certutil /encode /f "%~1" "%~1.encoded.1"
find /v /i "CERTIFICATE---" <"%~1.encoded.1" >"%~1.encoded.2"
(
echo((
echo(echo(-----BEGIN CERTIFICATE-----
for /f "usebackq delims=" %%a in ("%~nx1.encoded.2") do echo(echo(%%a
echo(echo(-----END CERTIFICATE-----
echo(^)^>"%~nx1.decode"
echo(certutil /decode /f "%~nx1.decode" "%~nx1" ^>nul
echo(del "%~nx1.decode"
)>"%~nx1.encoded.txt"
del "%~nx1.encoded.?"
Offline
Pages: 1