DOS Batch script to convert string 2 hex -


how can convert sring hex in dos batch script? example, convert "abcd" "61626364". since, 'a' 0x61...

i tried find solution web, day, not find answer.

@echo off setlocal enabledelayedexpansion  rem store string in chr.tmp file set /p "=%~1" < nul > chr.tmp  rem create zero.tmp file same number of ascii 0 characters %%a in (chr.tmp) fsutil file createnew zero.tmp %%~za > nul  rem compare both files fc /b , differences set "hex=" /f "skip=1 tokens=2" %%a in ('fc /b chr.tmp zero.tmp') set "hex=!hex!%%a"  del chr.tmp zero.tmp echo %hex% 

output example:

c:\> test.bat abcd 61626364 

Comments