home bbs files messages ]

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,668 of 68,980   
   Zaidy036 to All   
   Re: System Time   
   07 Nov 20 15:14:32   
   
   From: Zaidy036@air.isp.spam   
      
   On 11/6/2020 8:25 PM, Zaidy036 wrote:   
   > On 11/6/2020 5:55 PM, Zaidy036 wrote:   
   >> On 11/6/2020 4:25 PM, Zaidy036 wrote:   
   >>> On 11/6/2020 2:55 PM, Robert Roland wrote:   
   >>>> On Fri, 6 Nov 2020 12:37:24 -0500, Zaidy036    
   >>>> wrote:   
   >>>>   
   >>>>> 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.   
   >>>>   
   >>>> So, you want to see both the real time and the fake time at the same   
   >>>> time?   
   >>>>   
   >>>>> Any suggestions to directly retrieve the system time or have batch   
   >>>>> commands to run its own timer function independent of the system time?   
   >>>>   
   >>>> There is a hint in the description for RunAsTime.exe:   
   >>>>   
   >>>> RunAsDate Limitations:   
   >>>> RunAsDate will not affect applications that take the current date/time   
   >>>> from another source. For example: application that loads the current   
   >>>> date from remote server.   
   >>>>   
   >>>> If we simply use our own computer as a remote server, it seems to   
   >>>> work:   
   >>>>   
   >>>>   
   >>>> echo Apparent time is %date% %time%   
   >>>>   
   >>>> for /F "tokens=6,7" %%n in ('NET TIME \\%computername%^|find "Current   
   >>>> time"') do set realdate=%%n&set realtime=%%o   
   >>>>   
   >>>> echo Real time is %realdate% %realtime%   
   >>>>   
   >>> I did not know of "Net Time" so I turned the service on and ran the   
   >>> following test batch using RunAsDate:   
   >>>   
   >>> NET TIME \\i7 > F:\Timex1.txt   
   >>> TIMEOUT 10   
   >>> NET TIME \\i7 > F:\Timex2.txt   
   >>> TYPE F:\Timex1.txt   
   >>> TYPE F:\Timex2.txt   
   >>> PAUSE & EXIT   
   >>>   
   >>> It Worked....Thank you for pointing me to this command   
   >>>   
   >> Sorry, but I am weak on FOR /F statements and having trouble with it.   
   >> I know it is a one line command but it is not picking up the "real"   
   >> values. I have tried various "tokens=" combinations without success.   
   >>   
   >> I only need the realtime value to display the start and end times for   
   >> batch operations.   
   >>   
   >>FOR /F "tokens=7 delims= " %%n IN ('NET TIME \\i7') DO SET _TX=%%n   
   SET "_LineD=%_Spc12%%_TX%   
   >>   
   > I figured it out:   
   > FOR /F "tokens=7 delims= " %%n IN ('NET TIME \\%computername%') DO SET   
   > _TX=%%n   
      
   Just to report how my batch uses the above with success until Win 10   
   changes something again!!   
      
   Setup.bat for _Overnight.bat ends with the following(GDate=today+1 day):   
      SET _RunAsDate=D:\_NirSoft\runasdate-x64\RunAsDate.exe %GDate% 00:07:07   
      %_RunAsDate% "C:\Users\xxxx\Dropbox\Batch_Files\_Overnight.bat"   
      
   Multiple places in _Overnight.bat(_RPT is batch log):   
      FOR /F "tokens=7 delims= " %%n IN ('NET TIME \\i7') DO SET _TX=%%n   
      SET "_LineD=  %_TX%   
      [do something]   
      FOR /F "tokens=7 delims= " %%n IN ('NET TIME \\i7') DO SET _TX=%%n   
      SET "_LineD=%_LineD% - %_TX% [something text]"   
      ECHO %_LineD% >> %_RPT%   
      
   I defined _RunAsDate because I expect that a few operations in   
   _Overnight.bat will require that to function correctly.   
      
   --- 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