windows - Manipulating time in a batch file -
I was surprised 'if someone can help in this latch batch file. Here's the code I'm trying to when I was last successful Windows Update.
@ECHO OFF SETLOCAL SET RegKey = HKLM \ SOFTWARE \ Microsoft \ Windows CurrentVersion SET RegKey =% RegKey% \ WindowsUpdate \ Auto Update \ results for install / F "Leave = 1 Token = 2 *" %% A IN ('REG Query'% RegKey% / v 'LastSuccessTime') DO SET LastWUpd = %% If the " % ~ 1 "==" "ECHO Last Successful Windows Update:% Last WUpd% PAUSE Endoulic & amp; SET LastWUpd =% LastWUpd% IF "% ~ 1" == "" GOTO: EOF
And this is the output I received:
last successful Windows Update: 2009-10-14 09:02:52
I was amazing 'if there was any way to reduce the gap in time now? So that the line can be changed to read:
Last successful Windows update x years x month x day x hours x minutes ago if possible it would be great.
Thank you in advance,
Mathematical
I assists you with a command line utility to calculate date / time and solve your problem.
However, can you consider using PowerShell to accomplish the same task? I am not an expert on the topic, but since you can run NIT managed code on PS, you should be able to accomplish this task more easily.
Comments
Post a Comment