Sponge Belly wrote:Thanks for the pointers, npocmaka.
But this thread on a Russian forum proved to be instructive. Retouching the script I found there, I ended up with:Code: Select all
set ^"js=javascript:close(new ActiveXObject('Scripting.^
FileSystemObject'^).GetStandardStream(1^).Write(new String(new ^
Enumerator(new ActiveXObject('WbemScripting.SWbemLocator'^).^
ConnectServer('.','root\\cimv2'^).ExecQuery('Select LocalDateTime ^
from Win32_OperatingSystem where Primary=True'^)^).item(^).^
LocalDateTime^)^)^);^"
for /f %%t in ('mshta "%js%"') do echo(WMI LocalDateTime: %%t
Long-winded, but it works! And it should work for everyone, even any poor Windows XP Home bunnies still left out there.
- SB
Yes.There's no big difference when you use WMI classes through the activex objects?But after I saw this code started to wonder if it is necessary to create WMI objects to the time? Both javascript and vbscript have a good set date/time functions. According to me these classes are most interesting for enhancements of batch capabilities