Advertisement
Sabriel

многострок

Jan 18th, 2014
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.36 KB | None | 0 0
  1. 7) sizesum
  2.  
  3. Суммарный размер всех файлов на всех дисках
  4.  
  5. @echo off
  6. setlocal enabledelayedexpansion
  7. set b=0
  8. set summ=
  9. for %%z in (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z) do (
  10. if exist %%z:\ (
  11. for /f "tokens=3" %%i in ('dir %%z:\ /a-d /s ^| findstr /b "[0-9]"') do (
  12. for %%j in (%%i) do (
  13. set chis=!chis!%%j
  14. )
  15. set a=!chis!
  16. set chis=
  17. for /l %%n in (1,1,14) do (
  18. if not defined a (
  19. if not defined b (
  20. if !c! equ 1 (
  21. set c=0
  22. set summ=1!summ!
  23. )
  24. )
  25. )
  26. if defined a (
  27. if defined b (
  28. set /a summx=!c!+!a:~-1!+!b:~-1!
  29. if !c! equ 1 set c=0
  30. if !summx! geq 10 (
  31. set c=1
  32. set summx=!summx:~-1!
  33. )
  34. set a=!a:~,-1!
  35. set b=!b:~,-1!
  36. set summ=!summx!!summ!
  37. ) else (
  38. set /a summx=!c!+!a:~-1!
  39. if !c! equ 1 set c=0
  40. if !summx! geq 10 (
  41. set c=1
  42. set summx=!summx:~-1!
  43. )
  44. set a=!a:~,-1!
  45. set summ=!summx!!summ!
  46. )
  47. ) else (
  48. if defined b (
  49. set /a summx=!c!+!b:~-1!
  50. if !c! equ 1 set c=0
  51. if !summx! geq 10 (
  52. set c=1
  53. set summx=!summx:~-1!
  54. )
  55. set b=!b:~,-1!
  56. set summ=!summx!!summ!
  57. )
  58. )
  59. )
  60. set b=!summ!
  61. set summ=
  62. set summx=
  63. )
  64. )
  65. )
  66. echo !b!
  67. endlocal
  68.  
  69. 1.2) copspeed
  70.  
  71. @echo off
  72.  
  73. for /f "tokens=1,2,3 delims=:" %%a in ("%time%") do (
  74. set h=%%a
  75. set m=%%b
  76. set s=%%c
  77. )
  78. for /f "tokens=1,2 delims=," %%i in ("%s%") do (
  79. set sec=%%i
  80. set ms=%%j
  81. )
  82. if %m%==08 (set m=8)
  83. if %m%==09 (set m=9)
  84. if %sec%==08 (set sec=8)
  85. if %sec%==09 (set sec=9)
  86. if %ms%==08 (set ms=8)
  87. if %ms%==09 (set ms=8)
  88. set /a st=%h%*60*60*100+%m%*60*100+%sec%*100+%ms% 2>nul
  89.  
  90. copy %1 %2 > nul
  91.  
  92. for /f "tokens=1,2,3 delims=:" %%a in ("%time%") do (
  93. set h=%%a
  94. set m=%%b
  95. set s=%%c
  96. )
  97. for /f "tokens=1,2 delims=," %%i in ("%s%") do (
  98. set sec=%%i
  99. set ms=%%j
  100. )
  101. if %m%==08 (set m=8)
  102. if %m%==09 (set m=9)
  103. if %sec%==08 (set sec=8)
  104. if %sec%==09 (set sec=9)
  105. if %ms%==08 (set ms=8)
  106. if %ms%==09 (set ms=8)
  107. set /a ct=%h%*60*60*100+%m%*60*100+%sec%*100+%ms% 2>nul
  108. set /a dt=%ct%-%st% 2> nul
  109.  
  110. echo %dt% msec
  111. echo %~z1 byte
  112. set /a s=%~z1/1048576*100/%dt%
  113. if %s% == 0 (echo %~z1 byte per second) else (echo %s% Mb/sec)
  114.  
  115. 8) похоже это квадрат числа (надеюсь она никому не попадется)
  116.  
  117. @echo off
  118. SETLOCAL EnableDelayedExpansion
  119. set a=%1
  120. if !a! leq 0 set a=!a:~1!
  121. set summ=0
  122. set k=
  123. set cc=!a!
  124. set b=!a!
  125. set o=
  126. set summx=0
  127. for /l %%j in (1,1,20) do (
  128. if defined cc (
  129. set c=!cc:~-1!
  130. for /l %%i in (1,1,20) do (
  131. if defined a (
  132. set /a mn=!a:~-1!*!c!
  133. call :sum !summ! !mn!!k! summ
  134. set k=!k!0
  135. set a=!a:~,-1!
  136. ))
  137. call :sum !summx! !summ!!o! summx
  138. set o=!o!0
  139. set cc=!cc:~,-1!
  140. set a=!b!
  141. set summ=0
  142. set k=
  143. ))
  144. echo !summx!
  145. endlocal
  146. goto :eof
  147. :sum
  148. set az=%1
  149. set bz=%2
  150. set summxz=0
  151. set summz=
  152. for /l %%n in (1,1,50) do (
  153. if not defined az (
  154. if not defined bz (
  155. if !cz! equ 1 (
  156. set cz=0
  157. set summz=1!summz!
  158. )))
  159. if defined az (
  160. if defined bz (
  161. set /a summxz=!cz!+!az:~-1!+!bz:~-1!
  162. if !cz! equ 1 set cz=0
  163. if !summxz! geq 10 (
  164. set cz=1
  165. set summxz=!summxz:~-1!
  166. )
  167. set az=!az:~,-1!
  168. set bz=!bz:~,-1!
  169. set summz=!summxz!!summz!
  170. ) else (
  171. set /a summxz=!cz!+!az:~-1!
  172. if !cz! equ 1 set cz=0
  173. if !summxz! geq 10 (
  174. set cz=1
  175. set summxz=!summxz:~-1!
  176. )
  177. set az=!az:~,-1!
  178. set summz=!summxz!!summz!
  179. )
  180. ) else (
  181. if defined bz (
  182. set /a summxz=!cz!+!bz:~-1!
  183. if !cz! equ 1 set cz=0
  184. if !summxz! geq 10 (
  185. set cz=1
  186. set summxz=!summxz:~-1!
  187. )
  188. set bz=!bz:~,-1!
  189. set summz=!summxz!!summz!
  190. )))
  191. set %3=!summz!
  192. exit /b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement