Advertisement
npocmaka

dateTime.bat

Apr 20th, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.47 KB | None | 0 0
  1. @echo off
  2. setlocal
  3.  
  4. :: Define simple macros to support JavaScript within batch
  5. set "beginJS=mshta "javascript:close(new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1).Write("
  6. set "endJS=));""
  7.  
  8.  :: Direct instantiation requires that output is piped
  9.  %beginJS% (new Date()).getTime() %endJS% | findstr "^"
  10.  
  11. :: FOR /F does not need pipe
  12. for /f %%N in (
  13.   '%beginJS%(new Date()).getTime()%endJS%'
  14. ) do set date_time=%%N
  15. echo date_time=%date_time%
  16.  
  17. endlocal
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement