@echo off
set filenum=1
set filesize=10485760
set tmppth="c:\tmp"
set despth="z:\test"
rmdir %tmppth% /s /q
md %tmppth%
md %despth%
for /l %%i in (1,1,%filenum%) do fsutil file createnew %tmppth%\%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%%time:~9,2%%%i.testfile %filesize%
set starttime1=%time:~0,2%
set starttime2=%time:~3,2%
set starttime3=%time:~6,2%
echo.startime is:%starttime1%H%starttime2%M%starttime3%S
xcopy %tmppth% %despth%
set endtime1=%time:~0,2%
set endtime2=%time:~3,2%
set endtime3=%time:~6,2%
echo.endtime is:%endtime1%H%endtime2%M%endtime3%S
set/a hdiff=%endtime1%-%starttime1%
set/a mdiff=%endtime2%-%starttime2%
set/a sdiff=%endtime3%-%starttime3%
set/a totaltime=%hdiff%*24+%mdiff%*60+%sdiff%
if %totaltime%==0 (set/a totaltime=1)
echo.Total time is %totaltime% s.
set/a totalsize=%filesize%/1024/1024*%filenum%
echo.Total files size is %totalsize% MB.
set/a rate=%totalsize%/%totaltime%
echo.The rate is %rate%MB/s.
pause
标签:bat,set,windows,cmd,echo,2%,totaltime%,time,tmppth%
From: https://www.cnblogs.com/yiminlin/p/16791976.html