Skip to content

Instantly share code, notes, and snippets.

@TheBestUser01234567890
TheBestUser01234567890 / AppendHex.bat
Created July 1, 2024 12:04 — forked from davidruhmann/AppendHex.bat
[Batch] Generate a GUID in a command line batch
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:AppendHex <xReturn> <xInput>
:: Append a hexidecimal number to the end of the input.
:: 1. Generate Random Number = 0-15
:: 2. Convert Number to Hexidecimal
:: 3. Append to Input
setlocal
set /a "xValue=%RANDOM% %% 16"
if "%xValue%"=="10" set "xValue=A"
if "%xValue%"=="11" set "xValue=B"