[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
  1. @echo off&setlocal enabledelayedexpansion
  2. for /f "tokens=1,2 delims=:" %%i in ('time/t') do set hh=%%i&set mm=%%j
  3. for /f "tokens=1-3 delims=- " %%i in ('date/t') do set year=%%i&set month=%%j&set day=%%k
  4. set/a month=100%month%%%100,day=100%day%%%100,hh=100%hh%%%100,hh-=1
  5. if %hh% equ -1 set/a hh=23&call :datejs
  6. set/a month=10%month%,day=10%day%,hh=10%hh%
  7. set month=%month:~-2%&set day=%day:~-2%&set hh=%hh:~-2%
  8. set "rqsj=%year%-%month%-%day% %hh%:%mm%"
  9. for /f "delims=" %%i in ('dir/b/s/a-d e:\') do if "%%~ti" geq "%rqsj%" echo %%i
  10. pause&exit
  11. :datejs //**日期计算部分,以前写的,拿来凑合用**//
  12. for %%i in (1,5,7,10,12) do (
  13.    if %month% equ %%i (
  14.       if %day% neq 1 (set/a day-=1&goto :eof
  15.          ) else (
  16.            if %month% neq 1 (set/a month-=1,day=30&goto :eof
  17.               ) else (set/a year-=1,month=12,day=31&goto :eof)
  18. )
  19. )
  20. )
  21. for %%i in (2,4,6,8,9,11) do (
  22.    if %month% equ %%i (
  23.       if %day% neq 1 (set/a day-=1&goto :eof
  24.          ) else (set/a month-=1,day=31&goto :eof)
  25. )
  26. )
  27. set/a mod=!(year%%4)^&!(!(year%%100))^|!(year%%400)
  28. if %month% equ 3 (
  29.    if %mod% equ 1 (
  30.      if %day% neq 1 (set/a day-=1&goto :eof
  31.         ) else (set/a month-=1,day=29&goto :eof)
  32. ) else (
  33. if %day% neq 1 (set/a day-=1&goto :eof
  34.         ) else (set/a month-=1,day=28&goto :eof)
  35. )
  36. )
复制代码
1

评分人数

TOP

上面代码日期时间格式
C:\Documents and Settings\Administrator>date /t
2009-08-19 星期三

C:\Documents and Settings\Administrator>time /t
22:05

[ 本帖最后由 zhouyongjun 于 2009-8-19 22:08 编辑 ]

TOP

呵呵,被我混为一谈了,稍加修改就行了。。。

TOP

回复 12楼 的帖子

楼上正解........

TOP

返回列表