@echo off
set mm=%date:~4,2%
set dd=%date:~7,2%
set yy=%date:~12,2%
set hh=%time:~0,2%
set min=%time:~3,2%
set ss=%time:~6,2%
set /a ts=hh * 3600 + min * 60 + ss
call:toHex ts tsh
set bld=%yy%%mm%%dd%.%tsh%
echo %bld%>"%~dp0\Files\ver.txt"
exit
:toHex dec hex -- convert a decimal number to hexadecimal, i.e. -20 to FFFFFFEC or 26 to 0000001A
:: -- dec [in] - decimal number to convert
:: -- hex [out,opt] - variable to store the converted hexadecimal number in
::Thanks to 'dbenham' dostips forum users who inspired to improve this function
:$created 20091203 :$changed 20110330 :$categories Arithmetic,Encoding
:$source http://www.dostips.com
SETLOCAL ENABLEDELAYEDEXPANSION
set /a dec=%~1
set "hex="
set "map=0123456789ABCDEF"
for /L %%N in (1,1,8) do (
set /a "d=dec&15,dec>>=4"
for %%D in (!d!) do set "hex=!map:~%%D,1!!hex!"
)
rem !!!! REMOVE LEADING ZEROS by activating the next line, e.g. will return 1A instead of 0000001A
for /f "tokens=* delims=0" %%A in ("%hex%") do set "hex=%%A"&if not defined hex set "hex=0"
( ENDLOCAL & REM RETURN VALUES
IF "%~2" NEQ "" (SET %~2=%hex%) ELSE ECHO.%hex%
)