@Echo off

REM #New: 20.01.2023/J.Fes Get UTC Time and generates vars $DateTimeNowFileExt
REm
REM Usage:
Rem Call DateTimeGetUTC.cmd
REM Filename YEAR + Month + Day                    - #Exa: Y2023-M01-D20
REM set File_DPNE=%CmdCurRoot_DP%\FileName-%$DateTimeNowFileExt_YMD%.txt
REM Filename YEAR + Month + Day + Hour              - #Exa: Y2023-M01-D20-h10
REM set File_DPNE=%CmdCurRoot_DP%\FileName-%$DateTimeNowFileExt_YMDH%.txt
REM Filename YEAR + Month + Day + Hour + Min        - #Exa: Y2023-M01-D20-h10-m08
REM set File_DPNE=%CmdCurRoot_DP%\FileName-%$DateTimeNowFileExt_YMDHM%.txt
REM Filename YEAR + Month + Day + Hour + Min + Sec  - #Exa: Y2023-M01-D20-h10-m08-s10
REM set File_DPNE=%CmdCurRoot_DP%\FileName-%$DateTimeNowFileExt_YMDHMS%.txt

setlocal
 for /f %%x in ('wmic path win32_utctime get /format:list ^| findstr "="') do set %%x

 IF %Day% LSS 10  SET Day=0%Day%
 IF %Month% LSS 10  SET Month=0%Month%

 IF %Hour% LSS 10  SET Hour=0%Hour%
 IF %Minute% LSS 10  SET Minute=0%Minute%
 IF %Second% LSS 10  SET Second=0%Second%

 set $DateTimeNowFileExt_YMD=Y%YEAR%-M%Month%-D%Day%
 set $DateTimeNowFileExt_YMDH=%$DateTimeNowFileExt_YMD%-h%Hour%
 set $DateTimeNowFileExt_YMDHM=%$DateTimeNowFileExt_YMDH%-m%Minute%
 set $DateTimeNowFileExt_YMDHMS=%$DateTimeNowFileExt_YMDHM%-s%Second%


endlocal& set $DateTimeNowFileExt_YMD=%$DateTimeNowFileExt_YMD%& set $DateTimeNowFileExt_YMDH=%$DateTimeNowFileExt_YMDH%& set $DateTimeNowFileExt_YMDHM=%$DateTimeNowFileExt_YMDHM%& set $DateTimeNowFileExt_YMDHMS=%$DateTimeNowFileExt_YMDHMS%

REM set JobMgr_Debug=ON
if /i "%JobMgr_Debug%" neq "ON" goto :JumbOverDebug
 Echo #Debug..........................: %~nx0
 Echo #Debug..........................: List of DateTimeNowFileExt Values:
 Echo $DateTimeNowFileExt_YMD.........: %$DateTimeNowFileExt_YMD%
 Echo $DateTimeNowFileExt_YMDH........: %$DateTimeNowFileExt_YMDH%
 Echo $DateTimeNowFileExt_YMDHM.......: %$DateTimeNowFileExt_YMDHM%
 Echo $DateTimeNowFileExt_YMDHMS......: %$DateTimeNowFileExt_YMDHMS%
 pause
:JumbOverDebug
