Advertisement
Guest User

Judago

a guest
Mar 11th, 2010
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.42 KB | None | 0 0
  1. @ECHO OFF
  2. setlocal EnableDelayedExpansion
  3.  
  4. echo Please wait this could take some time.
  5. :begin
  6. for /f "tokens=2 delims=:" %%a in ('ipconfig /all^|find "IP Address."') do (
  7. set ip=%%a
  8. set ip=!ip:~1,-1!
  9. )
  10.  
  11. (set /p =!ip!,!computername!,<nul) >> output.txt
  12.  
  13. >nul ping google.com
  14. (
  15. if errorlevel 1 (
  16. set /p =no,<nul
  17. ) else (
  18. set /p =yes,<nul
  19. )
  20. ) >> output.txt
  21. :fsutil
  22. set n=1
  23. for /f "delims=" %%a in ('fsutil fsinfo drives^|find /v ""') do (
  24. set drive=%%a
  25. set drive=!drive:drives: =!
  26. set list!n!=
  27. for /f "tokens=2 delims=:" %%b in ('fsutil volume diskfree !drive!^|find /v "ready"') do (
  28. set huh=%%b
  29. set huh=!huh:~1,-1!
  30. for %%c in (!n!) do set list%%c=!list%%c!!huh!,
  31. )
  32. if defined list!n! (
  33. for %%c in (!n!) do set list%%c=!list%%c!!drive!
  34. set /a n+=1
  35. )
  36. )
  37. set /a n-=1
  38. for /l %%a in (1 1 !n!) do (
  39. for /f "tokens=1-4 delims=," %%b in ("!list%%a!") do (
  40. call :bigmath %%c / 1073741824 total
  41. call :bigmath %%d / 1073741824 free
  42. (set /p =%%e[!total!gb Total][!free!gb free]-<nul) >> output.txt
  43. )
  44. )
  45. >> output.txt echo ,!date! @ !time!
  46.  
  47. goto :eof
  48.  
  49.  
  50.  
  51. pause
  52.  
  53.  
  54. goto :eof
  55. :bigmath
  56. SETLOCAL ENABLEDELAYEDEXPANSION
  57. set optr=%~2
  58. set inpnum1=%1
  59. set inpnum2=0
  60. set dplace=
  61. set "varout=%~3"
  62. IF "%~3"=="" ENDLOCAL&GOTO :eof
  63. SET "VAROUT=%~4"
  64. set inpnum2=%3
  65. if "%inpnum1%"=="%inpnum1:.=%" if "%inpnum2%"=="%inpnum2:.=%" goto FLOATSKIP
  66. if "%inpnum1:~0,1%"=="." set inpnum1=0%inpnum1%
  67. if "%inpnum2:~0,1%"=="." set inpnum2=0%inpnum2%
  68. if "%inpnum1:~-1%"=="." set inpnum1=%inpnum1%0
  69. if "%inpnum2:~-1%"=="." set inpnum2=%inpnum2%0
  70. SET DP1=0
  71. SET DP2=0
  72. FOR /F "TOKENS=2 DELIMS=." %%A IN ("%INPNUM1%") DO (
  73. SET DPT=%%A
  74. FOR /L %%B IN (0 1 500) DO IF "!DPT:~%%B!"=="" SET /A DP1=%%B&&GOTO BL1
  75. )
  76. :BL1
  77. FOR /F "TOKENS=2 DELIMS=." %%A IN ("%INPNUM2%") DO (
  78. SET DPT=%%A
  79. FOR /L %%B IN (0 1 500) DO IF "!DPT:~%%B!"=="" SET /A DP2=%%B&&GOTO BL2
  80. )
  81. :BL2
  82. SET DPLACE=%DP1%
  83. IF NOT !DP1! EQU !DP2! (
  84. IF !DP1! LSS !DP2! (
  85. SET DPLACE=%dp2%
  86. SET /A DPT=DP2-DP1
  87. FOR /L %%A IN (1 1 !DPT!) DO SET INPNUM1=!INPNUM1!0
  88. ) ELSE (
  89. set dlace=%dp1%
  90. SET /A DPT=DP1-DP2
  91. FOR /L %%A IN (1 1 !DPT!) DO SET INPNUM2=!INPNUM2!0
  92. )
  93. )
  94.  
  95. SET INPNUM1=%INPNUM1:.=%
  96. SET INPNUM2=%INPNUM2:.=%
  97. :FLOATSKIP
  98. :dzer01
  99. if not "!inpnum1:~1!"=="" if "!inpnum1:~0,1!"=="0" (
  100. set inpnum1=!inpnum1:~1!
  101. goto dzer01
  102. )
  103. :dzer02
  104. if not "!inpnum2:~1!"=="" if "!inpnum2:~0,1!"=="0" (
  105. set inpnum2=!inpnum2:~1!
  106. goto dzer02
  107. )
  108.  
  109.  
  110. if "!optr!"=="-" goto subtract
  111. if "!optr!"=="+" goto add
  112. if "!optr!"=="*" goto multiply
  113. if "!optr!"=="/" (
  114. if !inpnum2! lss 1000000 (
  115. goto fastdiv
  116. ) else (
  117. goto divide
  118. )
  119. )
  120. goto :eof
  121.  
  122. :subtract
  123. for %%a in (stotal stten SUB1 SUB2 neg) do set %%a=
  124. if /I "%~1%~2"=="internal" (
  125. set sub1=!%3!
  126. set sub2=!%4!
  127. ) else (
  128. set sub1=!inpNUM1!
  129. set sub2=!inpNUM2!
  130. )
  131.  
  132. set subsub1=!sub2!
  133. set subsub2=!sub1!
  134. :sloop
  135. set sc1=
  136. set sc2=
  137. set sstrore=
  138. if defined sub1 (
  139. if defined sub2 (
  140. set sc1=%sub1:~-1%
  141. set sc2=%sub2:~-1%
  142. set sub1=%sub1:~0,-1%
  143. set sub2=%sub2:~0,-1%
  144. ) else (
  145. if defined stten (
  146. set sub2=!stten!
  147. set stten=
  148. set sc1=!sub1:~-1!
  149. set sc2=!sub2:~-1!
  150. set sub1=!sub1:~0,-1!
  151. set sub2=!sub2:~0,-1!
  152. ) else (
  153. set stotal=%sub1%%stotal%
  154. call :finish stotal
  155. goto soutput
  156. )
  157. )
  158. ) else (
  159. for %%a in (sub2 stten) do (
  160. if defined %%a (
  161. set sub1=%subsub1%
  162. set sub2=%subsub2%
  163. set neg=-
  164. set stotal=
  165. set stten=
  166. goto sloop
  167. )
  168. )
  169. call :finish stotal
  170. goto soutput
  171. )
  172. set sazc=
  173. set sazcnt=
  174. :asttend
  175. if !sc1!==0 if !sc2! gtr 0 if defined sub1 (
  176. set sazc=!sub1:~-1!
  177. set /a sazcnt+=1
  178. set sub1=!sub1:~0,-1!
  179. if !sazc!==0 goto asttend
  180. set /a sazc-=1
  181. set sc1=10
  182. set sub1=!sub1!!sazc!
  183. for /l %%a in (2,1,!sazcnt!) do set sub1=!sub1!9
  184. )
  185. if defined stten (
  186. set /a sc1-=1
  187. if !sc1! lss 0 (
  188. set /a stten+=1
  189. set /a sc1+=10
  190. ) else (
  191. set stten=
  192. )
  193. )
  194. set /a sstrore=%sc1%-%sc2%
  195. if !sstrore! lss 0 (
  196. set stten=1
  197. set /a sstrore+=10
  198. set stten=!stten:-=!
  199. )
  200. set stotal=%sstrore%%stotal%
  201. goto sloop
  202. :soutput
  203. if /I "%~1%~2"=="internal" (
  204. set %3=%stotal%
  205. goto :eof
  206. ) else (
  207. if not defined varout (
  208. echo %stotal%
  209. ENDLOCAL
  210. ) else (
  211. endlocal&set %varout%=%stotal%
  212. )
  213. )
  214. goto :eof
  215.  
  216. :add
  217. if /I "%~1%~2"=="internal" (
  218. set add1=!%3!
  219. set add2=!%4!
  220. ) else (
  221. set add1=!inpNUM1!
  222. set add2=!inpNUM2!
  223. )
  224. set atotal=
  225. set astore=
  226. set acarry=
  227. :aloop
  228. if not defined add1 (
  229. if defined acarry (
  230. set add1=%acarry%
  231. set acarry=
  232. ) else (
  233. set atotal=%add2%%atotal%
  234. call :finish atotal
  235. goto aoutput
  236. )
  237. )
  238. if not defined add2 (
  239. if defined acarry (
  240. set add2=%acarry%
  241. set acarry=
  242. ) else (
  243. set atotal=%add1%%atotal%
  244. call :finish atotal
  245. goto aoutput
  246. )
  247. )
  248. if not defined acarry (
  249. set /a astore=%add1:~-1%+%add2:~-1%
  250. ) else (
  251. set /a astore=%add1:~-1%+%add2:~-1%+%acarry%
  252. set acarry=
  253. )
  254. if !astore! lss 10 (
  255. set atotal=%astore%%atotal%
  256. ) else (
  257. set atotal=%astore:~-1%%atotal%
  258. set acarry=%astore:~0,-1%
  259. )
  260. set astore=
  261. set add1=%add1:~0,-1%
  262. set add2=%add2:~0,-1%
  263. goto aloop
  264. :aoutput
  265. if /I "%~1%~2"=="internal" (
  266. set %3=%atotal%
  267. ) else (
  268. if not defined varout (
  269. echo %atotal%
  270. ENDLOCAL
  271. ) else (
  272. endlocal&set %varout%=%atotal%
  273. )
  274. )
  275. goto :eof
  276.  
  277.  
  278. :MULTIPLY
  279. SET MTOTAL=0
  280. set /a ph=dplace*2
  281. set dplace=
  282. set mten=
  283. set mult1=!inpnum1!
  284. set mult2=!inpnum2!
  285. IF !mult1! equ 0 set mtotal=0&&goto moutput
  286. IF !mult2! equ 0 set mtotal=0&&goto moutput
  287. IF !mult2! equ 1 (
  288. set mtotal=%mult1%
  289. set dplace=!ph!
  290. call :finish mtotal
  291. goto moutput
  292. ) else (
  293. IF !mult1! equ 1 (
  294. set mtotal=%mult2%
  295. set dplace=!ph!
  296. call :finish mtotal
  297. goto moutput
  298. )
  299. )
  300. set m1=!mult1!
  301. for /l %%a in (2,1,9) do (
  302. call :add inte rnal m1 mult1
  303. set m%%a=!m1!
  304. )
  305. set m1=!mult1!
  306. :MPLY
  307. if defined mult2 (
  308. set mby=!mult2:~-1!
  309. set mult2=!mult2:~0,-1!
  310. ) else (
  311. set dplace=!ph!
  312. call :finish mtotal
  313. goto moutput
  314. )
  315. if !mby!==0 (
  316. set mten=%mten%0
  317. goto mply
  318. )
  319. set madvar=!m%mby%!%mten%
  320. call :add inte rnal mtotal madvar
  321. set mten=%mten%0
  322. goto mply
  323. :moutput
  324. if not defined varout (
  325. echo %mtotal%
  326. ENDLOCAL
  327. ) else (
  328. endlocal&set %varout%=%mtotal%
  329. )
  330. goto :eof
  331.  
  332. :divide
  333. if !inpnum2! equ 1 (
  334. set dtotal=%inpnum1%
  335. call :finish dtotal
  336. goto doutput
  337. )
  338. for %%a in (din1 din2 diff dten DCNT) do set %%a=
  339. set dtotal=0
  340. set dplace=10
  341. set inpnum1=!inpnum1!0000000000
  342. set div1=!inpnum1!
  343. set div2=!inpnum2!
  344. if !div2!==0 echo Divide by 0^^!>&2&&exit /b 2
  345. :din1
  346. if defined inpnum1 (
  347. set /a din1+=1
  348. set inpnum1=%inpnum1:~1%
  349. goto din1
  350. )
  351. :din2
  352. if defined inpnum2 (
  353. set /a din2+=1
  354. set inpnum2=%inpnum2:~1%
  355. goto din2
  356. )
  357. if !din2! gtr !din1! (
  358. set dtotal=0
  359. goto doutput
  360. )
  361. set /a diff=din1-din2
  362. for /l %%a in (1,1,%diff%) do set dten=!dten!0
  363. set ph=!dplace!
  364. set dplace=
  365. :div
  366. set dtmp=%div1%
  367. set daddvar=%div2%%dten%
  368. call :subtract inte rnal div1 daddvar
  369. if defined neg (
  370. set div1=!dtmp!
  371. set neg=
  372. if defined dten (
  373. set dten=!dten:~1!
  374. goto div
  375. ) else (
  376. set dplace=!ph!
  377. call :finish dtotal
  378. goto doutput
  379. )
  380. ) else (
  381. set daddvar=1%dten%
  382. call :add inte rnal dtotal daddvar
  383. if !div1! equ 0 (
  384. set dplace=!ph!
  385. call :finish dtotal
  386. goto doutput
  387. )
  388. goto div
  389. )
  390. :doutput
  391. if not defined varout (
  392. echo %dtotal%
  393. ENDLOCAL
  394. ) else (
  395. endlocal&set %varout%=%dtotal%
  396. )
  397. goto :eof
  398.  
  399. :fastdiv
  400. set fccnt=
  401. set dplace=10
  402. set fdiv=%inpnum1%0000000000
  403. set ftotal=
  404. :fsplit
  405. if not defined fdiv goto floop
  406. if !fdiv! gtr 999 (
  407. set /a fccnt+=1
  408. set fchunk!fccnt!=%fdiv:~-4%
  409. set fdiv=%fdiv:~0,-4%
  410. goto fsplit
  411. ) else (
  412. set /a fccnt+=1
  413. set fchunk!fccnt!=!Fdiv!
  414. )
  415. :floop
  416. if defined fchunk%fccnt% (
  417. if "!fchunk%fccnt%:~0,1!"=="0" (
  418. set fchunk%fccnt%=!fchunk%fccnt%:~1!
  419. goto floop
  420. )
  421. ) else (
  422. set fchunk%fccnt%=0
  423. goto fpad
  424. )
  425. set fvcnt=0
  426. :fsubloop
  427. If !fchunk%fccnt%! geq !inpnum2! (
  428. If !fchunk%fccnt%! geq !inpnum2!000 (
  429. set /a fchunk%fccnt%-=!inpnum2!000
  430. set /a fvcnt+=1000
  431. goto fsubloop
  432. ) else (
  433. If !fchunk%fccnt%! geq !inpnum2!00 (
  434. set /a fchunk%fccnt%-=!inpnum2!00
  435. set /a fvcnt+=100
  436. goto fsubloop
  437. ) else (
  438. If !fchunk%fccnt%! geq !inpnum2!0 (
  439. set /a fchunk%fccnt%-=!inpnum2!0
  440. set /a fvcnt+=10
  441. goto fsubloop
  442. ) else (
  443. set /a fchunk%fccnt%-=!inpnum2!
  444. set /a fvcnt+=1
  445. goto fsubloop
  446. )
  447. )
  448. )
  449. )
  450. :fpad
  451. if "!fvcnt:~3,1!"=="" set fvcnt=0!fvcnt!
  452. if "!fvcnt:~3,1!"=="" set fvcnt=0!fvcnt!
  453. if "!fvcnt:~3,1!"=="" set fvcnt=0!fvcnt!
  454. set ftotal=%ftotal%%Fvcnt%
  455. set fvcnt=0
  456. set ftmpcnt=%fccnt%
  457. set /a fccnt-=1
  458. if !fchunk%ftmpcnt%! gtr 0 (
  459. set fcarry=!fchunk%ftmpcnt%!
  460. set fchunk!fccnt!=!fcarry!!fchunk%fccnt%!
  461. )
  462. if %fccnt% equ 0 (
  463. call :finish ftotal
  464. goto foutput
  465. )
  466. goto floop
  467. :foutput
  468. if not defined varout (
  469. echo %ftotal%
  470. ENDLOCAL
  471. ) else (
  472. endlocal&set %varout%=%ftotal%
  473. )
  474. goto :eof
  475.  
  476.  
  477. :finish
  478. if !dplace! equ 0 set dplace=
  479. if defined dplace if "!%1:~%dplace%,1!"=="" set %1=0!%1!&&goto finish
  480. if defined dplace set %1=!%1:~0,-%dplace%!.!%1:~-%dplace%!
  481. :killzerodec
  482. if defined dplace (
  483. if "!%1:~-1!"=="0" (
  484. set %1=!%1:~0,-1!
  485. goto killzerodec
  486. ) else (
  487. if "!%1:~-1!"=="." (
  488. set %1=!%1:~0,-1!
  489. )
  490. )
  491. )
  492. :killzerowhle
  493. if "!%1:~0,1!"=="0" (
  494. set %1=!%1:~1!
  495. goto killzerowhle
  496. ) else (
  497. if "!%1:~0,1!"=="." set %1=0!%1!
  498. )
  499. IF NOT DEFINED %1 SET %1=0
  500. set %1=%neg%!%1!
  501. goto :eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement