We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1d35fc2 commit 5887b35Copy full SHA for 5887b35
1 file changed
stringutils/stringToHex.bat
@@ -0,0 +1,18 @@
1
+@echo off
2
+:stringToHex
3
+del tmp.hex >nul 2>nul
4
+del tmp.str >nul 2>nul
5
+echo|(set /p=%~1)>tmp.str
6
+
7
+certutil -encodehex tmp.str tmp.hex >nul
8
+setlocal enableDelayedExpansion
9
+set "hex_str="
10
+for /f "usebackq tokens=2 delims= " %%A in ("tmp.hex") do (
11
+ set "line=%%A"
12
+ set hex_str=!hex_str!!line:~0,48!
13
+ set hex_str=!hex_str: =!
14
15
+)
16
+::clears EOF character
17
+set "hex_str=%hex_str:~0,-2%"
18
+(echo(!hex_str!)
0 commit comments