1.    14 May 2016 #1
    Join Date : May 2016
    Auckland ,New Zealand
    Posts : 13
    Win10x64,Mint KDE,VMware-"Stuff"

    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 ComputerSystem Spec
  2.    14 May 2016 #2
    Join Date : May 2016
    Auckland ,New Zealand
    Posts : 13
    Win10x64,Mint KDE,VMware-"Stuff"
    Thread Starter

    Quote Originally Posted by Fronk View Post
    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 ComputerSystem Spec

 


Similar Threads
Thread Forum
SSD Maintenance
What does everyone do about keeping a SSD at top performance? Found a program called Tweak SSD,does anyone use this?. Are you suppose to defrag a SSD? Thanks for any tips and info on this. ...
Performance & Maintenance
Sub-script and Super-script
Is it possible to use sub-script and super-script when typing emails with Windows 10? I was able to do this when using Windows 7 and typing documents but not for emails. I was expecting that with the major up-grade to from 7 to 10 it would now be...
General Support
Maintenance on a seldom used PC
I have a "backup" PC that I run about one or two hours a week. (And this is the only one I've installed Win10 on so far.) When I had Win7 on it, I would usually check to see if there was useful or necessary maintenance whenever I had the PC up. ...
Performance & Maintenance
How to disable automatic maintenance?
I want to disable automatic maintenance because my new SSD is arriving soon, and since SSDs have a limited life span, I want to preserve them as much as possible. ( I know modern SSDs can last a loooooooooong time, I just want to be super careful...
Performance & Maintenance
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 06:30.
Find Us
Twitter Facebook Google+ Ten Forums iOS App Ten Forums Android App



Windows 10 Forums