My requirement is to create an output file with the following format: Filename,file size,checksum
An example would be abc.tar,1024 Bytes,052107adc8c42d6cf581bf81225ae6de
Code
setlocal enabledelayedexpansion
set OUTFILE="C:\Script\Batch_OUT.txt"
echo %OUTFILE%
echo Extracting Batch records to %OUTFILE% ...
echo pwd = `pwd`
cd C:\Script\TARS\
for %%f in (Batch_*.tar) do (
(echo %%~nxf && echo %%~zf Bytes && certutil -hashfile "%%f" MD5 | find /V ":") >>%OUTFILE%
)
pause 2m
Output
Batch_one.tar
778240 Bytes
052107adc8c42d6cf581bf81225ae6de
Expected Outcome
Batch_one.tar,778240 Bytes,052107adc8c42d6cf581bf81225ae6de