『楼 主』:
【版主】这个网站和cn-dos是何关系啊?
不知这个cmdos与CN-DOS是什么关系?
http://www.cmdos.net/article/sort03/list3_3.html
这个网站里的批处理代码大多是来自我们论坛,只是原作者换为
DOS资源站 www.cmdos.net
摘录几个,看有没你你很熟悉的代码:
@echo off&title DOS资源站 www.cmdos.net
set w=1
for /f "delims=" %%a in ('findstr /n .* a.txt') do set "var=%%a"&call :lis
echo.&echo 字符总数是 %u%
pause>nul
goto :eof
:lis
setlocal enabledelayedexpansion
set var=!var:*:=!
if not defined var endlocal&set /a w+=1&goto :eof
call :loop
echo 第 !w! 行有 !n! 个字符
endlocal&set /a u+=%n%,w+=1
goto :eof
:loop
if defined var (
set /a n+=1
set var=!var:~1!
goto loop
)
goto :eof
本文来自:DOS资源站(www.cmdos.net) 详细出处参考:http://www.cmdos.net/article/sort03/info-1454.html
@echo off&title DOS资源站 www.cmdos.net&color 9f&mode con lines=10
title 星期查询器
:set
cls
echo.&echo.&echo.
set var=
set /p var= 请输入要查询的日期(格式为2000年08月08日):
if "%var:~4,1%%var:~7,1%%var:~10,1%"=="年月日" goto year
cls
echo.&echo.&echo.
echo 输入格式不正确!请返回正确输入。&ping /n 3 127.1>nul&goto set
:year
set year=%var:~,4%
set /a str=(%year%-1904)/4&set /a str1=%year%-1904
for /l %%i in (0,1,3) do (
set a=%%i
setlocal enabledelayedexpansion
set /a str2=4*!str!+!a!
if !str1! equ !str2! goto month
)
:month
endlocal
if %a% equ 0 (set /a number1=%str%*1461) else (set /a number1=%str%*1461+%a%*365+1)
if %var:~5,1% equ 0 (set month=%var:~6,1%) else (set month=%var:~5,2%)
set /a month=%month%-1
if %month% equ 0 set /a number2=0&goto day
if %month% equ 1 set /a number2=31&goto day
if %month% equ 2 set /a number2=31+28
if %month% equ 3 set /a number2=31*2+28
if %month% equ 4 set /a number2=31*2+30+28
if %month% equ 5 set /a number2=31*3+30+28
if %month% equ 6 set /a number2=31*3+30*2+28
if %month% equ 7 set /a number2=31*4+30*2+28
if %month% equ 8 set /a number2=31*5+30*2+28
if %month% equ 9 set /a number2=31*5+30*3+28
if %month% equ 10 set /a number2=31*6+30*3+28
if %month% equ 11 set /a number2=31*6+30*4+28
if %a% equ 0 set /a number2=%number2%+1
:day
if %var:~8,1% equ 0 (set day=%var:~9,1%) else (set day=%var:~8,2%)
set /a number3=%day%-1
:week
set /a number=%number1%+%number2%+%number3%
set /a week=%number%/7
for /l %%i in (0,1,6) do (
set b=%%i
setlocal enabledelayedexpansion
set /a str=!week!*7+!b!
if !str! equ !number! goto echo
)
:echo
本文来自:DOS资源站(www.cmdos.net) 详细出处参考:http://www.cmdos.net/article/sort03/info-1455.html
@echo off&title DOS资源站 www.cmdos.net||显示两个时间点的差(精确到0.01秒),很实用的代码
:loop
set TA=%time% & echo %time%A
title 按任意键继续&pause>nul
set TB=%time% & echo %time%B
call:Timediff %TA% %TB% 0
title 按任意键继续...&pause>nul
goto:loop
:: /* Timediff -
:Timediff [%t1%] [%t2%] [par|0]
for %%a in (+%1 +%2 +%3)do if "%%a"=="+" echo 参数缺失!&exit/b
setlocal enabledelayedexpansion
:timediff_1
set P2=%~1&set "P2=!P2::=!"
set/a P2=%P2:.=%-4000*(%P2:~,4%+60*%P2:~,2%)
if not "%3"=="" set P1=!P2!&shift&goto:timediff_1
if !P2! geq !P1! (set/a df=!P2!-!P1!) else set/a df=!P2!-!P1!+8640000
set/a h=df/360000,m=df%%360000/6000,s=df%%6000/100,pt=df%%100
if %pt% leq 9 set pt=0%pt%
endlocal&if %2.==0. (echo\%h%:%m%:%s%.%pt%) else set %2=%h%:%m%:%s%.%pt%&goto:eof
:: - Timediff - */
本文来自:DOS资源站(www.cmdos.net) 详细出处参考:http://www.cmdos.net/article/sort03/info-1458.html
@echo off&title DOS资源站 www.cmdos.net&color ac&mode con cols=50 lines=10
title 这是我们每一个中国人的心声!!!
echo.&echo.&echo.
echo 打倒一切阻挠奥运的反动势力,全力支持奥运!
echo.
for /l %%i in (1,1,100) do call,set cls=%%cls%%
goto one
:two
set n=2&set var=08-07&goto begin
:one
set n=1&set var=%date:~5,-4%
:begin
set month=%var:~1,1%&set number=29
set /a month-=1
for /l %%i in (1,1,%month%) do call :lp %%i
set /a number+=100%var:~3,2%%%100
set str=%str% %number%
if not %n% equ 2 goto two
for /f "tokens=1,2" %%i in ("%str%") do set /a day=%%j-%%i
set /a hm=100-1000%time:~9,2%%%1000,m=60-100%time:~6,2%%%100,f=60-100%time:~3,2%%%100,s=43-%time:~,2%
if %hm% equ 100 set /a hm-=100,m+=1
if %m% equ 60 set /a m-=60,f+=1
if %f% equ 60 set /a f-=60,h+=1
if %s% geq 24 set /a s-=24,day+=1
set /p= 离北京奥运开幕还有%day%天%s%小时%f%分%m%秒%hm%毫秒<nul
set /p=%cls%<nul
set n=0&set number=0
goto begin
:lp
for %%i in (1,3,5,7,8,10) do if %%i equ %1 set /a number+=31
for %%i in (4,6,9,11) do if %%i equ %1 set /a number+=30
goto:eof
本文来自:DOS资源站(www.cmdos.net) 详细出处参考:http://cmdos.net/article/sort03/info-1624.html
|