Advertisement
Najeebsk

DATE-TIME-FOLDER.bat

Jan 6th, 2022
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.88 KB | None | 0 0
  1. @echo off
  2. COLOR 1B
  3. TITLE TIME & DATE FOLDER BY (c) NAJEEB (c) 2021
  4. :Time
  5. ::
  6. :: Get the TIME details
  7. ::
  8. Set "WT=%Time%"
  9. Set time.HH=%WT:~0,2%
  10. Set time.MM=%WT:~3,2%
  11. Set time.SS=%WT:~6,2%
  12.  
  13. ::==========================================================================
  14.  
  15. ==::
  16. Set time.AMPM=PM
  17. If /I %time.HH% LSS 10 (
  18.    Set time.HH=0%time.HH:~1,1%
  19. )
  20. If /I %time.HH% LSS 12 (
  21.    Set time.AMPM=AM
  22.    Set time.HH12=%time.HH%
  23. )  Else (
  24.    Set /a time.HH12=%time.HH%-12
  25. )
  26. If /I %time.MM% LSS 10 (
  27.    Set time.MM=%time.MM:~1,1%
  28. )
  29. If /I %time.SS% LSS 10 (
  30.    Set time.SS=%time.SS:~1,1%
  31. )
  32. If /I %time.HH12% lss 10 (
  33.    Set time.HH12=%time.HH12%
  34. )
  35. Set time.HHMMSS=%time.HH%%time.MM%%time.SS%
  36. Set time.HHMMSS2=%time.HH12%%time.MM%%time.SS%%time.AMPM%
  37. Set time.USA=%time.HH%.%time.MM%.%time.SS%
  38. Set time.USA2=%time.HH12%.%time.MM%.%time.SS% %time.AMPM%
  39. :Month
  40. for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set
  41.  
  42. dt=%%a
  43. set year=%dt:~0,4%
  44. set month=%dt:~4,2%
  45. set day=%dt:~6,2%
  46. set sec=%dt:~12,6%
  47. set hh=%dt:~8,2%
  48. set min=%dt:~10,2%
  49. if %month% == 01 set monthname=Jan
  50. if %month% == 02 set monthname=Feb
  51. if %month% == 03 set monthname=Mar
  52. if %month% == 04 set monthname=Apr
  53. if %month% == 05 set monthname=May
  54. if %month% == 06 set monthname=Jun
  55. if %month% == 07 set monthname=Jul
  56. if %month% == 08 set monthname=Aug
  57. if %month% == 09 set monthname=Sep
  58. if %month% == 10 set monthname=Oct
  59. if %month% == 11 set monthname=Nov
  60. if %month% == 12 set monthname=Dec
  61. :Day
  62. set dy=%DATE:~0,3%
  63. IF %dy% == Mon set dayofweek=Monday
  64. IF %dy% == Tue set dayofweek=Tuesday
  65. IF %dy% == Wed set dayofweek=Wednesday
  66. IF %dy% == Thu set dayofweek=Thursday
  67. IF %dy% == Fri set dayofweek=Friday
  68. IF %dy% == Sat set dayofweek=Saturday
  69. IF %dy% == Sun set dayofweek=Sunday
  70. set mydir="%dayofweek% %day%-%monthname%-%year%  %time.HH12%.%time.MM%.
  71.  
  72. %time.SS% %time.AMPM%"
  73. mkdir %mydir%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement