Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @ECHO OFF
- setlocal EnableDelayedExpansion
- echo Please wait this could take some time.
- :begin
- for /f "tokens=2 delims=:" %%a in ('ipconfig /all^|find "IP Address."') do (
- set ip=%%a
- set ip=!ip:~1,-1!
- )
- (set /p =!ip!,!computername!,<nul) >> output.txt
- >nul ping google.com
- (
- if errorlevel 1 (
- set /p =no,<nul
- ) else (
- set /p =yes,<nul
- )
- ) >> output.txt
- :fsutil
- set n=1
- for /f "delims=" %%a in ('fsutil fsinfo drives^|find /v ""') do (
- set drive=%%a
- set drive=!drive:drives: =!
- set list!n!=
- for /f "tokens=2 delims=:" %%b in ('fsutil volume diskfree !drive!^|find /v "ready"') do (
- set huh=%%b
- set huh=!huh:~1,-1!
- for %%c in (!n!) do set list%%c=!list%%c!!huh!,
- )
- if defined list!n! (
- for %%c in (!n!) do set list%%c=!list%%c!!drive!
- set /a n+=1
- )
- )
- set /a n-=1
- for /l %%a in (1 1 !n!) do (
- for /f "tokens=1-4 delims=," %%b in ("!list%%a!") do (
- call :bigmath %%c / 1073741824 total
- call :bigmath %%d / 1073741824 free
- (set /p =%%e[!total!gb Total][!free!gb free]-<nul) >> output.txt
- )
- )
- >> output.txt echo ,!date! @ !time!
- goto :eof
- pause
- goto :eof
- :bigmath
- SETLOCAL ENABLEDELAYEDEXPANSION
- set optr=%~2
- set inpnum1=%1
- set inpnum2=0
- set dplace=
- set "varout=%~3"
- IF "%~3"=="" ENDLOCAL&GOTO :eof
- SET "VAROUT=%~4"
- set inpnum2=%3
- if "%inpnum1%"=="%inpnum1:.=%" if "%inpnum2%"=="%inpnum2:.=%" goto FLOATSKIP
- if "%inpnum1:~0,1%"=="." set inpnum1=0%inpnum1%
- if "%inpnum2:~0,1%"=="." set inpnum2=0%inpnum2%
- if "%inpnum1:~-1%"=="." set inpnum1=%inpnum1%0
- if "%inpnum2:~-1%"=="." set inpnum2=%inpnum2%0
- SET DP1=0
- SET DP2=0
- FOR /F "TOKENS=2 DELIMS=." %%A IN ("%INPNUM1%") DO (
- SET DPT=%%A
- FOR /L %%B IN (0 1 500) DO IF "!DPT:~%%B!"=="" SET /A DP1=%%B&&GOTO BL1
- )
- :BL1
- FOR /F "TOKENS=2 DELIMS=." %%A IN ("%INPNUM2%") DO (
- SET DPT=%%A
- FOR /L %%B IN (0 1 500) DO IF "!DPT:~%%B!"=="" SET /A DP2=%%B&&GOTO BL2
- )
- :BL2
- SET DPLACE=%DP1%
- IF NOT !DP1! EQU !DP2! (
- IF !DP1! LSS !DP2! (
- SET DPLACE=%dp2%
- SET /A DPT=DP2-DP1
- FOR /L %%A IN (1 1 !DPT!) DO SET INPNUM1=!INPNUM1!0
- ) ELSE (
- set dlace=%dp1%
- SET /A DPT=DP1-DP2
- FOR /L %%A IN (1 1 !DPT!) DO SET INPNUM2=!INPNUM2!0
- )
- )
- SET INPNUM1=%INPNUM1:.=%
- SET INPNUM2=%INPNUM2:.=%
- :FLOATSKIP
- :dzer01
- if not "!inpnum1:~1!"=="" if "!inpnum1:~0,1!"=="0" (
- set inpnum1=!inpnum1:~1!
- goto dzer01
- )
- :dzer02
- if not "!inpnum2:~1!"=="" if "!inpnum2:~0,1!"=="0" (
- set inpnum2=!inpnum2:~1!
- goto dzer02
- )
- if "!optr!"=="-" goto subtract
- if "!optr!"=="+" goto add
- if "!optr!"=="*" goto multiply
- if "!optr!"=="/" (
- if !inpnum2! lss 1000000 (
- goto fastdiv
- ) else (
- goto divide
- )
- )
- goto :eof
- :subtract
- for %%a in (stotal stten SUB1 SUB2 neg) do set %%a=
- if /I "%~1%~2"=="internal" (
- set sub1=!%3!
- set sub2=!%4!
- ) else (
- set sub1=!inpNUM1!
- set sub2=!inpNUM2!
- )
- set subsub1=!sub2!
- set subsub2=!sub1!
- :sloop
- set sc1=
- set sc2=
- set sstrore=
- if defined sub1 (
- if defined sub2 (
- set sc1=%sub1:~-1%
- set sc2=%sub2:~-1%
- set sub1=%sub1:~0,-1%
- set sub2=%sub2:~0,-1%
- ) else (
- if defined stten (
- set sub2=!stten!
- set stten=
- set sc1=!sub1:~-1!
- set sc2=!sub2:~-1!
- set sub1=!sub1:~0,-1!
- set sub2=!sub2:~0,-1!
- ) else (
- set stotal=%sub1%%stotal%
- call :finish stotal
- goto soutput
- )
- )
- ) else (
- for %%a in (sub2 stten) do (
- if defined %%a (
- set sub1=%subsub1%
- set sub2=%subsub2%
- set neg=-
- set stotal=
- set stten=
- goto sloop
- )
- )
- call :finish stotal
- goto soutput
- )
- set sazc=
- set sazcnt=
- :asttend
- if !sc1!==0 if !sc2! gtr 0 if defined sub1 (
- set sazc=!sub1:~-1!
- set /a sazcnt+=1
- set sub1=!sub1:~0,-1!
- if !sazc!==0 goto asttend
- set /a sazc-=1
- set sc1=10
- set sub1=!sub1!!sazc!
- for /l %%a in (2,1,!sazcnt!) do set sub1=!sub1!9
- )
- if defined stten (
- set /a sc1-=1
- if !sc1! lss 0 (
- set /a stten+=1
- set /a sc1+=10
- ) else (
- set stten=
- )
- )
- set /a sstrore=%sc1%-%sc2%
- if !sstrore! lss 0 (
- set stten=1
- set /a sstrore+=10
- set stten=!stten:-=!
- )
- set stotal=%sstrore%%stotal%
- goto sloop
- :soutput
- if /I "%~1%~2"=="internal" (
- set %3=%stotal%
- goto :eof
- ) else (
- if not defined varout (
- echo %stotal%
- ENDLOCAL
- ) else (
- endlocal&set %varout%=%stotal%
- )
- )
- goto :eof
- :add
- if /I "%~1%~2"=="internal" (
- set add1=!%3!
- set add2=!%4!
- ) else (
- set add1=!inpNUM1!
- set add2=!inpNUM2!
- )
- set atotal=
- set astore=
- set acarry=
- :aloop
- if not defined add1 (
- if defined acarry (
- set add1=%acarry%
- set acarry=
- ) else (
- set atotal=%add2%%atotal%
- call :finish atotal
- goto aoutput
- )
- )
- if not defined add2 (
- if defined acarry (
- set add2=%acarry%
- set acarry=
- ) else (
- set atotal=%add1%%atotal%
- call :finish atotal
- goto aoutput
- )
- )
- if not defined acarry (
- set /a astore=%add1:~-1%+%add2:~-1%
- ) else (
- set /a astore=%add1:~-1%+%add2:~-1%+%acarry%
- set acarry=
- )
- if !astore! lss 10 (
- set atotal=%astore%%atotal%
- ) else (
- set atotal=%astore:~-1%%atotal%
- set acarry=%astore:~0,-1%
- )
- set astore=
- set add1=%add1:~0,-1%
- set add2=%add2:~0,-1%
- goto aloop
- :aoutput
- if /I "%~1%~2"=="internal" (
- set %3=%atotal%
- ) else (
- if not defined varout (
- echo %atotal%
- ENDLOCAL
- ) else (
- endlocal&set %varout%=%atotal%
- )
- )
- goto :eof
- :MULTIPLY
- SET MTOTAL=0
- set /a ph=dplace*2
- set dplace=
- set mten=
- set mult1=!inpnum1!
- set mult2=!inpnum2!
- IF !mult1! equ 0 set mtotal=0&&goto moutput
- IF !mult2! equ 0 set mtotal=0&&goto moutput
- IF !mult2! equ 1 (
- set mtotal=%mult1%
- set dplace=!ph!
- call :finish mtotal
- goto moutput
- ) else (
- IF !mult1! equ 1 (
- set mtotal=%mult2%
- set dplace=!ph!
- call :finish mtotal
- goto moutput
- )
- )
- set m1=!mult1!
- for /l %%a in (2,1,9) do (
- call :add inte rnal m1 mult1
- set m%%a=!m1!
- )
- set m1=!mult1!
- :MPLY
- if defined mult2 (
- set mby=!mult2:~-1!
- set mult2=!mult2:~0,-1!
- ) else (
- set dplace=!ph!
- call :finish mtotal
- goto moutput
- )
- if !mby!==0 (
- set mten=%mten%0
- goto mply
- )
- set madvar=!m%mby%!%mten%
- call :add inte rnal mtotal madvar
- set mten=%mten%0
- goto mply
- :moutput
- if not defined varout (
- echo %mtotal%
- ENDLOCAL
- ) else (
- endlocal&set %varout%=%mtotal%
- )
- goto :eof
- :divide
- if !inpnum2! equ 1 (
- set dtotal=%inpnum1%
- call :finish dtotal
- goto doutput
- )
- for %%a in (din1 din2 diff dten DCNT) do set %%a=
- set dtotal=0
- set dplace=10
- set inpnum1=!inpnum1!0000000000
- set div1=!inpnum1!
- set div2=!inpnum2!
- if !div2!==0 echo Divide by 0^^!>&2&&exit /b 2
- :din1
- if defined inpnum1 (
- set /a din1+=1
- set inpnum1=%inpnum1:~1%
- goto din1
- )
- :din2
- if defined inpnum2 (
- set /a din2+=1
- set inpnum2=%inpnum2:~1%
- goto din2
- )
- if !din2! gtr !din1! (
- set dtotal=0
- goto doutput
- )
- set /a diff=din1-din2
- for /l %%a in (1,1,%diff%) do set dten=!dten!0
- set ph=!dplace!
- set dplace=
- :div
- set dtmp=%div1%
- set daddvar=%div2%%dten%
- call :subtract inte rnal div1 daddvar
- if defined neg (
- set div1=!dtmp!
- set neg=
- if defined dten (
- set dten=!dten:~1!
- goto div
- ) else (
- set dplace=!ph!
- call :finish dtotal
- goto doutput
- )
- ) else (
- set daddvar=1%dten%
- call :add inte rnal dtotal daddvar
- if !div1! equ 0 (
- set dplace=!ph!
- call :finish dtotal
- goto doutput
- )
- goto div
- )
- :doutput
- if not defined varout (
- echo %dtotal%
- ENDLOCAL
- ) else (
- endlocal&set %varout%=%dtotal%
- )
- goto :eof
- :fastdiv
- set fccnt=
- set dplace=10
- set fdiv=%inpnum1%0000000000
- set ftotal=
- :fsplit
- if not defined fdiv goto floop
- if !fdiv! gtr 999 (
- set /a fccnt+=1
- set fchunk!fccnt!=%fdiv:~-4%
- set fdiv=%fdiv:~0,-4%
- goto fsplit
- ) else (
- set /a fccnt+=1
- set fchunk!fccnt!=!Fdiv!
- )
- :floop
- if defined fchunk%fccnt% (
- if "!fchunk%fccnt%:~0,1!"=="0" (
- set fchunk%fccnt%=!fchunk%fccnt%:~1!
- goto floop
- )
- ) else (
- set fchunk%fccnt%=0
- goto fpad
- )
- set fvcnt=0
- :fsubloop
- If !fchunk%fccnt%! geq !inpnum2! (
- If !fchunk%fccnt%! geq !inpnum2!000 (
- set /a fchunk%fccnt%-=!inpnum2!000
- set /a fvcnt+=1000
- goto fsubloop
- ) else (
- If !fchunk%fccnt%! geq !inpnum2!00 (
- set /a fchunk%fccnt%-=!inpnum2!00
- set /a fvcnt+=100
- goto fsubloop
- ) else (
- If !fchunk%fccnt%! geq !inpnum2!0 (
- set /a fchunk%fccnt%-=!inpnum2!0
- set /a fvcnt+=10
- goto fsubloop
- ) else (
- set /a fchunk%fccnt%-=!inpnum2!
- set /a fvcnt+=1
- goto fsubloop
- )
- )
- )
- )
- :fpad
- if "!fvcnt:~3,1!"=="" set fvcnt=0!fvcnt!
- if "!fvcnt:~3,1!"=="" set fvcnt=0!fvcnt!
- if "!fvcnt:~3,1!"=="" set fvcnt=0!fvcnt!
- set ftotal=%ftotal%%Fvcnt%
- set fvcnt=0
- set ftmpcnt=%fccnt%
- set /a fccnt-=1
- if !fchunk%ftmpcnt%! gtr 0 (
- set fcarry=!fchunk%ftmpcnt%!
- set fchunk!fccnt!=!fcarry!!fchunk%fccnt%!
- )
- if %fccnt% equ 0 (
- call :finish ftotal
- goto foutput
- )
- goto floop
- :foutput
- if not defined varout (
- echo %ftotal%
- ENDLOCAL
- ) else (
- endlocal&set %varout%=%ftotal%
- )
- goto :eof
- :finish
- if !dplace! equ 0 set dplace=
- if defined dplace if "!%1:~%dplace%,1!"=="" set %1=0!%1!&&goto finish
- if defined dplace set %1=!%1:~0,-%dplace%!.!%1:~-%dplace%!
- :killzerodec
- if defined dplace (
- if "!%1:~-1!"=="0" (
- set %1=!%1:~0,-1!
- goto killzerodec
- ) else (
- if "!%1:~-1!"=="." (
- set %1=!%1:~0,-1!
- )
- )
- )
- :killzerowhle
- if "!%1:~0,1!"=="0" (
- set %1=!%1:~1!
- goto killzerowhle
- ) else (
- if "!%1:~0,1!"=="." set %1=0!%1!
- )
- IF NOT DEFINED %1 SET %1=0
- set %1=%neg%!%1!
- goto :eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement