Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.msdos.batch.nt    |    Fun with Windows NT batch files    |    68,980 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 67,667 of 68,980    |
|    mokomoji to All    |
|    Re: System Time    |
|    07 Nov 20 08:53:37    |
   
   From: mokomoji@naver.com   
      
   2020년 11월 7일 토요일 오전 2시 37분 26초 UTC+9에 Zaidy036님이   
   작성한 내용:   
   > In a batch we use %Time% to find the current system time.    
   >    
   > I am using NirSoft\runasdate-x64\RunAsDate.exe to run a batch but then    
   > time is "frozen" and I still want to read the system time.    
   >    
   > Any suggestions to directly retrieve the system time or have batch    
   > commands to run its own timer function independent of the system time?   
      
   Crazy way   
   [code]   
      
   @echo off   
   cd /d "%~dp0"   
   setlocal   
   rem chcp 437   
   title=time.windows.com NTP server use date/time    
   echo [auto country word type]   
   chcp|find "437" 2>nul>nul&&(   
   set "z_time.pm=PM"   
   set "z_time.s_Capital=seoul"   
   set "z_time.n_Capital=pyongyang"   
   )   
   chcp|find "949" 2>nul>nul&&(   
   set "z_time.pm=오후"   
   set "z_time.s_Capital=서울"   
   set "z_time.n_Capital=평양"   
   )   
      
      
   for /f "delims=" %%f in ('tzutil /l') do (   
   echo "%%f"|find /i "(UTC+00:00)"   
   echo "%%f"|find /i "%z_time.s_Capital%"   
   echo "%%f"|find /i "%z_time.n_Capital%"   
   )   
      
   echo AM/PM TYPE %z_time.pm%   
   for /f "skip=2 tokens=4,5,6,7,8,9 delims=:- " %%f in (   
   'w32tm /stripchart /computer:time.windows.com /samples:1'   
   ) do (   
   call set z_hour=%%j   
   if /i "%%i" equ "%z_time.pm%" call set /a z_hour=%%j+12   
   if "%%j" lss "10" call set z_hour=0%%j   
   echo "%%f-%%g-%%h"|findstr "20[0-9][0-9]-[0-1][0-9]-[0-3]" 2>nul>nul&&call set   
   "z_reardate=%%f-%%g-%%h"   
   call echo "%%z_hour%%:%%k"|findstr "[0-2][0-9]:[0-5][0-9]" 2>nul>nul&&call set   
   z_reartime=%%z_hour%%:%%k   
   )   
   echo republic of s.korea   
   echo date %z_reardate%   
   echo time %z_reartime%   
   pause   
      
      
      
      
   [code]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca