-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfree_space_full.cmd
171 lines (137 loc) · 7.81 KB
/
free_space_full.cmd
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
@echo off
setlocal enabledelayedexpansion
net session >nul 2>&1
if %errorlevel% neq 0 (
echo This script requires administrator privileges.
echo Please right-click and select "Run as administrator".
timeout /t 5 /nobreak
exit /b 1
)
cd /d "%SystemDrive%" >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to change to %SystemDrive%
)
echo Setting registry keys on %SystemDrive%...
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Active Setup Temp Folders" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "Active Setup Temp Folders" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\BranchCache" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "BranchCache" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\D3D Shader Cache" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "D3D Shader Cache" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Delivery Optimization Files" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "Delivery Optimization Files" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Device Driver Packages" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "Device Driver Packages" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Diagnostic Data Viewer database files" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "Diagnostic Data Viewer database files" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Downloaded Program Files" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "Downloaded Program Files" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Internet Cache Files" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "Internet Cache Files" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Language Pack" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "Language Pack" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Offline Pages Files" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "Offline Pages Files" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Old ChkDsk Files" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "Old ChkDsk Files" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Previous Installations" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "Previous Installations" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Recycle Bin" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "Recycle Bin" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\RetailDemo Offline Content" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "RetailDemo Offline Content" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Service Pack Cleanup" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "Service Pack Cleanup" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Setup Log Files" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "Setup Log Files" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\System error memory dump files" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "System error memory dump files" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\System error minidump files" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "System error minidump files" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Temporary Files" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "Temporary Files" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Temporary Setup Files" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "Temporary Setup Files" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Temporary Sync Files" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "Temporary Sync Files" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Thumbnail Cache" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "Thumbnail Cache" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Update Cleanup" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "Update Cleanup" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Upgrade Discarded Files" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "Upgrade Discarded Files" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\User file versions" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "User file versions" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows Defender" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "Windows Defender" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows Error Reporting Files" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "Windows Error Reporting Files" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows ESD installation files" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "Windows ESD installation files" registry key.
)
call REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows Upgrade Log Files" /v StateFlags9999 /t REG_DWORD /d 00000002 /f >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set "Windows Upgrade Log Files" registry key.
)
echo Freeing up space on all drives...
call cleanmgr /sagerun:9999 >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to free up space on all drives.
)
timeout /t 5 /nobreak
exit /b 0