Fronk's maintenance script


  1. Posts : 13
    Win10x64,Mint KDE,VMware-"Stuff"
       #1

    Fronk's maintenance script


    Id like to share a script Ive made/ assembled as a thank you for being able to view and use this forum and 7 forum previously.
    Im not entirely shore how to post it but here goes-LoL.
    copy the .txt below and change to to .bat extension on you desktop or root.(script is below *****)


    Code:
    @echo off
    color 0a
    cls
    Title PC CLEANER 1
    echo ========================================================
    echo off
    echo = This program will help you clean your PC on C:Drive  =
    echo   = To escape at any time press ctrl+c then y for yes =
    echo off
    echo ========================================================
    echo 1. Uninstall Programs.(windows unistaller)
    echo 2. Clean up unnecessary files to create more drive Space.(Windows Clean manager)
    echo 3. Tools(Remove StartUp Programs),(Msconfig),(boot),(Tools),(System configuration),(defrag),(Trim),(computer management).etc
    echo[
    echo 4. Scan for viruses and errors.(System file checker)
    echo 5. Check for and repair bad sectors on Disk. (Checkdisk)
    echo 6. Repair network connections(Release/Renew DHCP leases,Flush ARP cache,Purge NBT cache)This may need to be run twice if it fails.
    echo[
    echo 7. Reset ip and flush DNS, you may need to reset connection to router from pc after using this.
    echo 8. Just test my Internet.
    echo[
    echo Press One of the numbers above and then hit enter.
    echo ======================================
    echo  Items 4-7, need to be run as "ADMIN"
    echo ======================================
    echo[
    echo note// Check disk or Scandisk will  not start unless you, "Run file as administrator".
    
    echo.
    set /p "cho=>"
    if %cho%==1 goto 1A
    if %cho%==2 goto 2A
    if %cho%==3 goto 3A
    if %cho%==4 goto 4A
    if %cho%==5 goto 5A
    if %cho%==6 goto 6A
    if %cho%==7 goto 7A
    if %cho%==8 goto 8A
    
    :1A
    appwiz.cpl
    goto end
    
    :2A
    cleanmgr
    goto end
    
    :3A
    msconfig
    goto end
    
    :4A
    sfc /scannow
    goto end
    
    :5A
    chkdsk C: /F/I/C/R
    goto end
    
    :6A
    @echo off
    echo %time%: Beginning network repair process.
    :: BEGIN Callout A
    REM echo %time%: Releasing DHCP lease(s)...
    REM ipconfig /release > NUL
    :: END Callout A
    echo %time%: Renewing DHCP lease(s)...
    ipconfig /renew > NUL
    echo %time%: Flushing ARP cache...
    arp -d * > NUL
    :: BEGIN Callout B
    echo %time%: Purging NBT remote cache table....
    nbtstat -R | find /i "failed" 1>&2
    echo %time%: Releasing and refreshing registered NBT names...
    nbtstat -RR | find /i "failed" 1>&2
    :: END Callout B
    echo %time%: Flushing DNS cache...
    ipconfig /flushdns > NUL
    echo %time%: Registering with DNS...
    ipconfig /registerdns > NUL
    echo %time%: Network repair process done.
    Pause
    goto end
    
    :7A
    echo This will reset IP and flush DNS
    netsh int ip reset C:\resetlog.txt
    netsh winsock reset
    ipconfig /flushdns
    Pause
    goto end
    
    
    
    :8A
    Rem: Easy way for anyone to see if a computer is on the network/internet and even do some basic troubleshooting.
    
    Rem:It assumes that you are on a LAN, with a router at ip of 192.168.1.1 If not then extract the info from an ipconfig and change it , like it is, it will work and should be good to go normally.
    Rem: Here is the basic rundown on what it does
    Rem: 
    
    1. Trys to ping Google with 1 packet, if it succeeds it ends with a success message.
    2. If it fails, it will try 3 more packets, if that succeeds, it will finish but warn it detected packet loss.
    3. If it still fails, it will try by IP address to test DNS, if this succeeds it will tell you that it had DNS issues.
    4. If it still fails it will try to ping 192.168.1.1 and if it succeeds will tell you it can reach the router but not internet.
    5. If the ping to 192.168.1.1 fails, it will tell you the network is down.
    @echo off ECHO Checking connection, please wait... PING -n 1 www.google.com|find "Reply from " >NUL IF NOT ERRORLEVEL 1 goto :SUCCESS IF ERRORLEVEL 1 goto :TRYAGAIN :TRYAGAIN ECHO FAILURE! ECHO Let me try a bit more, please wait... @echo off PING -n 3 www.google.com|find "Reply from " >NUL IF NOT ERRORLEVEL 1 goto :SUCCESS2 IF ERRORLEVEL 1 goto :TRYIP :TRYIP ECHO FAILURE! ECHO Checking DNS... ECHO Lets try by IP address... @echo off ping -n 1 216.239.37.99|find "Reply from " >NUL IF NOT ERRORLEVEL 1 goto :SUCCESSDNS IF ERRORLEVEL 1 goto :TRYROUTER :TRYROUTER ECHO FAILURE! ECHO Lets try pinging the router.... ping -n 2 192.168.1.1|find "Reply from " >NUL IF NOT ERRORLEVEL 1 goto :ROUTERSUCCESS IF ERRORLEVEL 1 goto :NETDOWN :ROUTERSUCCESS ECHO It appears that you can reach the router, but internet is unreachable. goto :FAILURE :NETDOWN ECHO FAILURE! ECHO It appears that you having network issues, the router cannot be reached. goto :FAILURE :SUCCESSDNS ECHO It appears that you are having DNS issues. goto :FAILURE :SUCCESS ECHO You have an active Internet connection pause goto :END :SUCCESS2 ECHO You have an active internet connection but some packet loss was detected. pause goto :END :FAILURE ECHO You do not have an active Internet connection pause Cls exit

    Cheers Fronk.
    P.S use at your own risk no warranty expreesed or implied.
    Fronk's maintenance script Attached Files
    Last edited by Brink; 14 May 2016 at 21:21. Reason: code box
      My Computer


  2. Posts : 13
    Win10x64,Mint KDE,VMware-"Stuff"
    Thread Starter
       #2

    Fronk said:
    Id like to share a script Ive made/ assembled as a thank you for being able to view and use this forum and 7 forum previously.
    Im not entirely shore how to post it but here goes-LoL.
    copy the .txt below and change to to .bat extension on you desktop or root.(script is below *****)


    Code:
    @echo off
    color 0a
    cls
    Title PC CLEANER 1
    echo ========================================================
    echo off
    echo = This program will help you clean your PC on C:Drive  =
    echo   = To escape at any time press ctrl+c then y for yes =
    echo off
    echo ========================================================
    echo 1. Uninstall Programs.(windows unistaller)
    echo 2. Clean up unnecessary files to create more drive Space.(Windows Clean manager)
    echo 3. Tools(Remove StartUp Programs),(Msconfig),(boot),(Tools),(System configuration),(defrag),(Trim),(computer management).etc
    echo[
    echo 4. Scan for viruses and errors.(System file checker)
    echo 5. Check for and repair bad sectors on Disk. (Checkdisk)
    echo 6. Repair network connections(Release/Renew DHCP leases,Flush ARP cache,Purge NBT cache)This may need to be run twice if it fails.
    echo[
    echo 7. Reset ip and flush DNS, you may need to reset connection to router from pc after using this.
    echo 8. Just test my Internet.
    echo[
    echo Press One of the numbers above and then hit enter.
    echo ======================================
    echo  Items 4-7, need to be run as "ADMIN"
    echo ======================================
    echo[
    echo note// Check disk or Scandisk will  not start unless you, "Run file as administrator".
    
    echo.
    set /p "cho=>"
    if %cho%==1 goto 1A
    if %cho%==2 goto 2A
    if %cho%==3 goto 3A
    if %cho%==4 goto 4A
    if %cho%==5 goto 5A
    if %cho%==6 goto 6A
    if %cho%==7 goto 7A
    if %cho%==8 goto 8A
    
    :1A
    appwiz.cpl
    goto end
    
    :2A
    cleanmgr
    goto end
    
    :3A
    msconfig
    goto end
    
    :4A
    sfc /scannow
    goto end
    
    :5A
    chkdsk C: /F/I/C/R
    goto end
    
    :6A
    @echo off
    echo %time%: Beginning network repair process.
    :: BEGIN Callout A
    REM echo %time%: Releasing DHCP lease(s)...
    REM ipconfig /release > NUL
    :: END Callout A
    echo %time%: Renewing DHCP lease(s)...
    ipconfig /renew > NUL
    echo %time%: Flushing ARP cache...
    arp -d * > NUL
    :: BEGIN Callout B
    echo %time%: Purging NBT remote cache table....
    nbtstat -R | find /i "failed" 1>&2
    echo %time%: Releasing and refreshing registered NBT names...
    nbtstat -RR | find /i "failed" 1>&2
    :: END Callout B
    echo %time%: Flushing DNS cache...
    ipconfig /flushdns > NUL
    echo %time%: Registering with DNS...
    ipconfig /registerdns > NUL
    echo %time%: Network repair process done.
    Pause
    goto end
    
    :7A
    echo This will reset IP and flush DNS
    netsh int ip reset C:\resetlog.txt
    netsh winsock reset
    ipconfig /flushdns
    Pause
    goto end
    
    
    
    :8A
    Rem: Easy way for anyone to see if a computer is on the network/internet and even do some basic troubleshooting.
    
    Rem:It assumes that you are on a LAN, with a router at ip of 192.168.1.1 If not then extract the info from an ipconfig and change it , like it is, it will work and should be good to go normally.
    Rem: Here is the basic rundown on what it does
    Rem: 
    
    1. Trys to ping Google with 1 packet, if it succeeds it ends with a success message.
    2. If it fails, it will try 3 more packets, if that succeeds, it will finish but warn it detected packet loss.
    3. If it still fails, it will try by IP address to test DNS, if this succeeds it will tell you that it had DNS issues.
    4. If it still fails it will try to ping 192.168.1.1 and if it succeeds will tell you it can reach the router but not internet.
    5. If the ping to 192.168.1.1 fails, it will tell you the network is down.
    @echo off ECHO Checking connection, please wait... PING -n 1 www.google.com|find "Reply from " >NUL IF NOT ERRORLEVEL 1 goto :SUCCESS IF ERRORLEVEL 1 goto :TRYAGAIN :TRYAGAIN ECHO FAILURE! ECHO Let me try a bit more, please wait... @echo off PING -n 3 www.google.com|find "Reply from " >NUL IF NOT ERRORLEVEL 1 goto :SUCCESS2 IF ERRORLEVEL 1 goto :TRYIP :TRYIP ECHO FAILURE! ECHO Checking DNS... ECHO Lets try by IP address... @echo off ping -n 1 216.239.37.99|find "Reply from " >NUL IF NOT ERRORLEVEL 1 goto :SUCCESSDNS IF ERRORLEVEL 1 goto :TRYROUTER :TRYROUTER ECHO FAILURE! ECHO Lets try pinging the router.... ping -n 2 192.168.1.1|find "Reply from " >NUL IF NOT ERRORLEVEL 1 goto :ROUTERSUCCESS IF ERRORLEVEL 1 goto :NETDOWN :ROUTERSUCCESS ECHO It appears that you can reach the router, but internet is unreachable. goto :FAILURE :NETDOWN ECHO FAILURE! ECHO It appears that you having network issues, the router cannot be reached. goto :FAILURE :SUCCESSDNS ECHO It appears that you are having DNS issues. goto :FAILURE :SUCCESS ECHO You have an active Internet connection pause goto :END :SUCCESS2 ECHO You have an active internet connection but some packet loss was detected. pause goto :END :FAILURE ECHO You do not have an active Internet connection pause Cls exit

    Cheers Fronk.
    P.S use at your own risk no warranty expreesed or implied.
    Hey looks like Brink edited this for me(code box..? who knew.... LOL)- ch,ch cheers Brink
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 15:46.
Find Us




Windows 10 Forums