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,664 of 68,980   
   Zaidy036 to All   
   Re: System Time   
   06 Nov 20 20:25:05   
   
   From: Zaidy036@air.isp.spam   
      
   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.   
   >   
   >   
   >   
   I figured it out:   
   FOR /F "tokens=7 delims= " %%n IN ('NET TIME \\%computername%') DO SET   
   _TX=%%n   
      
   --- 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