-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathoptimize_ntfs.cmd
More file actions
90 lines (81 loc) · 3.14 KB
/
optimize_ntfs.cmd
File metadata and controls
90 lines (81 loc) · 3.14 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
@echo off
setlocal
cd /d "%SystemDrive%" >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to change to %SystemDrive%. Error code: %errorlevel%
)
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 10 /nobreak
exit /b 1
)
echo #=======================================================#
echo # Optimizing NTFS behavior settings. #
echo # These changes require a system reboot to take effect. #
echo #=======================================================#
echo.
echo Setting NTFS memory usage:
echo 0: System default (automatic memory management).
echo 1: Balanced memory usage (recommended for most systems).
echo 2: High memory usage (better performance, requires 16GB+ RAM).
:mem_prompt
set /p memchoice=Enter your choice (0-2):
if not "%memchoice%"=="0" if not "%memchoice%"=="1" if not "%memchoice%"=="2" (
echo Invalid choice. Please enter 0, 1, or 2.
goto mem_prompt
)
fsutil behavior set memoryusage %memchoice% >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set memory usage. Error code: %errorlevel%
)
echo.
echo Setting MFT Zone size:
echo 1: ~12.5%% of volume (default, suitable for most users).
echo 2: ~25%% of volume (good for volumes with moderate file counts).
echo 3: ~37.5%% of volume (for high file-count scenarios, e.g., servers).
echo 4: ~50%% of volume (maximum reservation, use only if MFT fragmentation is a severe issue; reduces available space).
:mft_prompt
set /p mftchoice=Enter your choice (1-4):
if not "%mftchoice%"=="1" if not "%mftchoice%"=="2" if not "%mftchoice%"=="3" if not "%mftchoice%"=="4" (
echo Invalid choice. Please enter 1, 2, 3, or 4.
goto mft_prompt
)
fsutil behavior set mftzone %mftchoice% >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set MFT Zone. Error code: %errorlevel%
)
echo.
echo Setting 8.3 filename creation:
echo 0: Enable (default, required for legacy applications).
echo 1: Disable (recommended for modern systems - improves performance).
:dot3_prompt
set /p dot3choice=Enter your choice (0-1):
if not "%dot3choice%"=="0" if not "%dot3choice%"=="1" (
echo Invalid choice. Please enter 0 or 1.
goto dot3_prompt
)
fsutil behavior set disable8dot3 %dot3choice% >nul 2>&1
if %errorlevel% neq 0 (
echo Failed to set 8.3 filename creation. Error code: %errorlevel%
)
echo.
echo #==================================================================#
echo # NTFS optimization complete! #
echo #==================================================================#
echo # IMPORTANT: These changes require a system reboot to take effect. #
echo # It is recommended to reboot your system now. #
echo #==================================================================#
echo.
set /p rebootchoice=Would you like to reboot now? (Y/N):
if /i "%rebootchoice%"=="Y" (
echo Rebooting system in 30 seconds...
timeout /t 30 /nobreak >nul 2>&1
shutdown /r /t 1 >nul 2>&1
) else (
echo Please reboot your system for changes to take effect.
)
timeout /t 10 /nobreak
endlocal
exit /b 0