根据文件大小来做百分比。- @echo off
- if "%date:~-3,2%" equ "星期" (set 中=y)
- if defined 中 (
- set ec1=正在准备,请稍候。。。&set ec2=当前目录
- set ec3=当前进度&set ec4=总进度&set ec5=正在考拷贝&set ec6=完成
- ) else (
- set ec1=Please wait...&set ec2=Directory&set ec3=copying
- set ec4=Total&set ec5=File&set "ec6=OK!!"
- )
- echo %ec1%
- setlocal enabledelayedexpansion
- set n=1
- for /f "skip=2 delims=" %%a in ('dir /s /-c /a-d %1') do (
- set "str=%%a"
- if defined 中 (
- if "!str:~-3!" equ "的目录" (set/a d+=1&set #!d!n=!str:~1,-4!) else (
- for /f "tokens=1,2,3*" %%b in ("%%a") do (
- if "%%d" neq "" (
- set var=%%d
- if defined end (set/a total=!var:~,-3!+0&goto :next) else (
- if "%%c" equ "个文件" (set #!d!s=%%b&set/a n=1,#!d!z=!var:~,-3!+1) else (set #!d!.!n!=%%e&set/a #!d!.!n!.=!var:~,-1!+0,n+=1)
- )) else (set end=y)
- ))
- ) else (
- if "!str:~1,9!" equ "Directory" (set/a d+=1&set #!d!n=!str:~14!) else (
- for /f "tokens=1,2,3*" %%b in ("%%a") do (
- if "%%b" neq "Total" (
- set var=%%d
- if defined end (set/a total=!var:~,-3!+0&goto :next) else (
- if "%%c" equ "File(s)" (set #!d!s=%%b&set/a n=1,#!d!z=!var:~,-3!+1) else (set #!d!.!n!=%%e&set/a #!d!.!n!.=!var:~,-1!+0,n+=1)
- )) else (set end=y)
- ))
- )
- )
-
- :next
- set "bbb=>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
- set "eee= =============================="
- for /l %%a in (1,1,%d%) do (
- set dir=
- set num=
- for /l %%b in (1,1,!#%%as!) do (set/a num+=#%%a.%%b.
- set/a ec=!num! / !#%%az!
- set/a tot+=#%%a.%%b.
- set/a et=!tot! / !total!
- set/a b1=ec/3+1,b2=et/3+1
-
- rem copy /z !#%%an!\!#%%a.%%b! %2 >nul
- cls
-
- echo.&echo.&echo.&echo.
- echo %ec5%: !#%%a.%%b!
- for /f "tokens=1,2" %%c in ("!b1! !b2!") do (
-
- echo %ec2%: !#%%an!
- echo %ec3%: !bbb:~-%%c!!ec!%%!eee:~%%c!
- echo.
- echo %ec4%: !bbb:~-%%d!!et!%%!eee:~%%d!
- )
- ping -n 1 127.1 >nul
- ping -n 1 127.1 >nul
- )
-
- )
- echo !ec6!
- pause
复制代码
[ 本帖最后由 netbenton 于 2009-5-3 21:00 编辑 ] |