Skip to content

Commit

Permalink
Create file2hex.bat
Browse files Browse the repository at this point in the history
  • Loading branch information
npocmaka committed Nov 30, 2017
1 parent ffa65bf commit 56bda6b
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions fileUtils/file2hex.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@echo off
:stringToHex
del tmp.hex >nul 2>nul

if "%~2" equ "" (
echo destination not given
exit /b 10
)

set "source=%~f1"
set "destination=%~2"
del "%destination%" >nul 2>&1

if not exist "%source%" (
echo source file "%source%" does not exist
exit /b 11
)

certutil -encodehex "%source%" tmp.hex >nul
setlocal enableDelayedExpansion
set "hex_str="
for /f "usebackq tokens=2 delims= " %%A in ("tmp.hex") do (
set "line=%%A"
set line=!line:~0,48!
)>>"%destination%"
del tmp.hex >nul 2>nul

0 comments on commit 56bda6b

Please sign in to comment.