Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for sortdate.bat

(view source code of sortdate.bat as plain text)

  1. @ECHO OFF
  2. :: SortDate, Version 2.00 for Windows NT
  3. :: Save date and "sorted" date in environment variables.
  4. ::
  5. :: This batch file will always display the same results,
  6. :: independent of "International" settings.
  7. :: This batch file uses REG.EXE from the NT Resource Kit
  8. :: to read the "International" settings from the registry.
  9. ::
  10. :: Written by Rob van der Woude
  11. :: http://www.robvanderwoude.com
  12.  
  13. FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET DATE=%%B
  14. :: Delims is a TAB followed by a space
  15. FOR /F "TOKENS=2* DELIMS=	 " %%A IN ('REG QUERY "HKEY_CURRENT_USER\Control Panel\International\iDate"') DO SET iDate=%%B
  16. FOR /F "TOKENS=2* DELIMS=	 " %%A IN ('REG QUERY "HKEY_CURRENT_USER\Control Panel\International\sDate"') DO SET sDate=%%B
  17. IF %iDate%==0 FOR /F "TOKENS=1-4* DELIMS=%sDate% " %%A IN ('DATE/T') DO SET SortDate=%%D%%B%%C
  18. IF %iDate%==1 FOR /F "TOKENS=1-4* DELIMS=%sDate% " %%A IN ('DATE/T') DO SET SortDate=%%D%%C%%B
  19. IF %iDate%==2 FOR /F "TOKENS=1-4* DELIMS=%sDate% " %%A IN ('DATE/T') DO SET SortDate=%%B%%C%%D
  20. ECHO It's %DATE% today
  21. ECHO For sorting purposes: %SortDate%
  22.  

page last modified: 2024-04-16; loaded in 0.0049 seconds