Created
December 2, 2024 05:10
-
-
Save saeedvir/e99839741d8a20e6e1e973dd8729f238 to your computer and use it in GitHub Desktop.
refresh and cleanup windows and network
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
:: ============================ | |
:: Batch File for System Cleanup and Memory Release | |
:: ============================ | |
:: Ensure the script is run as administrator | |
net session >nul 2>&1 | |
if %errorLevel% neq 0 ( | |
echo Please run this script as administrator. | |
pause | |
exit /b | |
) | |
:: ============================ | |
:: Stop Unnecessary Processes | |
:: ============================ | |
set processes=GoogleCrashHandler.exe GoogleCrashHandler64.exe GoogleUpdate.exe ^ | |
nvtray.exe NvBackend.exe chrome.exe firefox.exe IDMan.exe IDMIntegrator64.exe ^ | |
IEMonitor.exe WiseTray.exe WiseCare365.exe SearchApp.exe msiexec.exe rundll32.exe ^ | |
nvxdsync.exe | |
for %%P in (%processes%) do ( | |
echo Terminating %%P... | |
taskkill /F /T /IM %%P >nul 2>&1 | |
) | |
:: ============================ | |
:: Stop Unnecessary Services | |
:: ============================ | |
set services=wuauserv UsoSvc Spooler SysMain XboxGipSvc CDPSvc CDPUserSvc WSearch | |
for %%S in (%services%) do ( | |
echo Stopping service %%S... | |
sc stop %%S >nul 2>&1 | |
) | |
:: ============================ | |
:: Cleanup TEMP Directory | |
:: ============================ | |
echo Cleaning TEMP directory... | |
del %TEMP%\*.* /f /s /q >nul 2>&1 | |
RD %TEMP%\. /S /Q >nul 2>&1 | |
:: ============================ | |
:: Run SpeedyFox Optimizations from Current Directory | |
:: ============================ | |
echo Running SpeedyFox optimizations... | |
if exist "%~dp0speedyfox.exe" ( | |
"%~dp0speedyfox.exe" "/Firefox:default" "/Firefox:default-release" "/Chrome:Default" | |
) else ( | |
echo SpeedyFox executable not found in the current directory. | |
) | |
:: ============================ | |
:: Perform Idle System Maintenance | |
:: ============================ | |
echo Performing idle tasks... | |
REM %windir%\system32\rundll32.exe advapi32.dll,ProcessIdleTasks | |
:: ============================ | |
:: Release Memory | |
:: ============================ | |
echo Releasing system memory... | |
:: Flush DNS Cache | |
ipconfig /flushdns >nul | |
echo DNS cache flushed. | |
:: Run PowerShell Garbage Collection | |
powershell -command "[System.GC]::Collect(); [System.GC]::WaitForPendingFinalizers(); [System.GC]::Collect();" | |
echo Garbage collection completed. | |
:: Free Standby Memory (using RAMMap or other tools if available) | |
if exist "%~dp0RAMMap.exe" ( | |
echo Freeing standby memory using RAMMap... | |
start "" "./RAMMap.exe" -Ews | |
) else ( | |
echo RAMMap tool not found. Skipping standby memory clearance. | |
) | |
:: ============================ | |
:: Final Pause for Completion | |
:: ============================ | |
timeout /t 1 >nul | |
echo All tasks completed. Memory released. | |
:: Improved Network Troubleshooting Script | |
:: Display network interface details | |
echo Showing network interfaces... | |
netsh interface show interface | |
echo. | |
:: Flush the DNS cache | |
echo Flushing DNS resolver cache... | |
ipconfig /flushdns | |
timeout /t 1 >nul | |
:: Release the current IP configuration | |
echo Releasing current IP configuration... | |
ipconfig /release | |
timeout /t 1 >nul | |
:: Renew the IP configuration | |
echo Renewing IP configuration... | |
ipconfig /renew | |
timeout /t 1 >nul | |
:: Reset Winsock | |
echo Resetting Winsock... | |
netsh winsock reset | |
timeout /t 1 >nul | |
:: Reset TCP/IP stack | |
echo Resetting TCP/IP stack... | |
netsh int ip reset | |
timeout /t 1 >nul | |
:: Test connectivity by pinging Google | |
echo Testing internet connectivity... | |
ping www.google.com | |
timeout /t 10 >nul | |
:: Notify user the script is complete | |
echo Network troubleshooting complete. Press any key to exit. | |
pause | |
:: Exit Script | |
exit |
Author
saeedvir
commented
Dec 2, 2024
- add processes to stop in line 17
- add services to stop in line 30
- (line 47) download speedyfox.exe from https://crystalidea.com/speedyfox
- (line 74) download Rammap.exe https://learn.microsoft.com/en-us/sysinternals/downloads/rammap
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment