-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptimise.bat
114 lines (83 loc) · 3.41 KB
/
optimise.bat
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
@echo off
SETLOCAL EnableDelayedExpansion
REM --> Check for permissions
IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
>nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
) ELSE (
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
)
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params= %*
echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
:gotAdmin
pushd "%CD%"
CD /D "%~dp0"
echo [ PERFORMANCE ]
REGEDIT /s "%~dp0/reg/adjust_for_best_performance_of_background_services.reg"
echo Adjusted for best performance of Background Services.
REGEDIT /s "%~dp0/reg/adjust_visual_effects_for_best_performance.reg"
echo Adjusted Visual Effects for best performance.
REGEDIT /s "%~dp0/reg/disable_paging.reg"
echo Disabled paging.
echo.
echo [ POWER ]
echo Restoring default power configurations...
powercfg -restoredefaultschemes
for /f "tokens=2,4 delims=:()" %%G in ('powercfg /import "%~dp0/config.pow"') do (
set high_performance_schema=%%G
)
@powercfg /changename %high_performance_schema% "Real-time Audio Configuration" "Designed for high performance with real-time audio."
echo Setting power configuration to "Real-time Audio Configuration":
@powercfg /setactive %high_performance_schema%
echo + Set minimum processor state to 100%
echo + Never sleep or hibernate
echo + Never turn off the display
echo + Set 'Turn off hard disk' to 'Never'
echo + Disable USP selective suspend
echo.
echo [ NETWORK ]
PowerShell.exe -NoProfile -Command "& {Start-Process PowerShell.exe -ArgumentList '-NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -File ""%~dp0/ps/disable_fc_im.ps1""' -Verb RunAs}"
echo Searching for wireless network adapters:
netsh wlan show interfaces | find "There is no wireless interface on the system."
set /A count=0
for /f "tokens=2 delims=:" %%G in ('netsh wlan show interfaces') do (
set item=%%G
if !count!==1 netsh interface set interface "!item:~1!" disable
if !count!==1 echo Disabled "!item:~1!".
set /A count+=1
)
echo.
PowerShell.exe -NoProfile -Command "& {Start-Process PowerShell.exe -ArgumentList '-NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -File ""%~dp0/ps/disable_nagling.ps1""' -Verb RunAs}"
echo Disabled Nagle's algorithm.
echo.
echo [ MISCELLANEOUS ]
REGEDIT /s "%~dp0/reg/disable_windows_sounds.reg"
echo Disabled Windows sounds.
REGEDIT /s "%~dp0/reg/disable_background_apps.reg"
echo Disabled background applications.
@sc stop "WSearch"
@sc config "WSearch" start=disabled
echo Disabled search indexing.
@sc config "Name of Service" start= disabled
@sc stop "Name of Service"
@reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f
echo Disabled UAC.
@wmic path Win32_PNPEntity where "caption like '%bluetooth%' AND DeviceID like 'USB\\%'" call disable
echo Disabled Bluetooth adapters.
net stop wuauserv
sc config wuauserv start=disabled
echo Disabled Windows update service.
REGEDIT /s "%~dp0/reg/disable_automatic_updates.reg"
echo Disabled automatic updates.
echo.
echo Congrats. Audio will now pass flawlessly.
TIMEOUT /T 3