-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclear_ram_loop.bat
More file actions
73 lines (58 loc) · 2.82 KB
/
clear_ram_loop.bat
File metadata and controls
73 lines (58 loc) · 2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
@echo off
title Windows Optimizer Script
color 0A
:: === One-time: Disable Windows Updates ===
echo [*] Disabling Windows Updates...
sc stop wuauserv >nul 2>&1
sc config wuauserv start= disabled >nul 2>&1
sc stop UsoSvc >nul 2>&1
sc config UsoSvc start= disabled >nul 2>&1
sc stop bits >nul 2>&1
sc config bits start= disabled >nul 2>&1
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v NoAutoUpdate /t REG_DWORD /d 1 /f >nul
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v AUOptions /t REG_DWORD /d 1 /f >nul
reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications" /v ToastEnabled /t REG_DWORD /d 0 /f >nul
schtasks /Change /TN "Microsoft\Windows\WindowsUpdate\Scheduled Start" /Disable >nul 2>&1
schtasks /Change /TN "Microsoft\Windows\WindowsUpdate\sih" /Disable >nul 2>&1
schtasks /Change /TN "Microsoft\Windows\WindowsUpdate\sihboot" /Disable >nul 2>&1
echo [✓] Windows Update Disabled.
echo.
:loop
echo ============================
echo [*] Starting Optimization Loop
echo ============================
:: === Show RAM usage before ===
echo [*] RAM Usage Before:
powershell -command "Get-CimInstance Win32_OperatingSystem | ForEach-Object { Write-Output ('Used: {0:N2} GB / Total: {1:N2} GB' -f (($_.TotalVisibleMemorySize - $_.FreePhysicalMemory)/1MB), ($_.TotalVisibleMemorySize/1MB)) }"
:: === Clean temp folders ===
echo [*] Cleaning temp folders...
del /q /f /s %TEMP%\* >nul 2>&1
del /q /f /s C:\Windows\Temp\* >nul 2>&1
:: === Flush DNS ===
echo [*] Flushing DNS cache...
ipconfig /flushdns >nul
:: === Clear RAM ===
echo [*] Attempting RAM Trim...
powershell -command "Get-Process | Where-Object { $_.Id -ne $PID } | ForEach-Object { try { $_.MinWorkingSet = $_.MinWorkingSet } catch {} }"
:: === Show RAM usage after ===
echo [*] RAM Usage After:
powershell -command "Get-CimInstance Win32_OperatingSystem | ForEach-Object { Write-Output ('Used: {0:N2} GB / Total: {1:N2} GB' -f (($_.TotalVisibleMemorySize - $_.FreePhysicalMemory)/1MB), ($_.TotalVisibleMemorySize/1MB)) }"
:: === Close bloat background tasks ===
echo [*] Killing background apps...
taskkill /f /im OneDrive.exe >nul 2>&1
taskkill /f /im Teams.exe >nul 2>&1
taskkill /f /im AdobeIPCBroker.exe >nul 2>&1
taskkill /f /im AdobeCollabSync.exe >nul 2>&1
taskkill /f /im ArmouryCrate.UserSessionHelper.exe
taskkill /f /im GameSDK.exe
taskkill /f /im NahimicService.exe
taskkill /f /im AuraService.exe
:: === Run RamMap to clear standby list ===
echo [*] Running RamMap64 to clear standby memory...
:: Accept the EULA silently to prevent dialog
reg add "HKCU\Software\Sysinternals\RamMap" /v EulaAccepted /t REG_DWORD /d 1 /f >nul
:: Run RamMap silently with the -Et -Es -Em -Ew flag to clear everything
"D:\WindBatchCustom\RAMMap64.exe" -Et -Es -Em -Ew
echo [✓] Cleanup Done. Sleeping for 10 seconds...
timeout /t 10 >nul
goto loop