добавь проверку на запуск скрипта от имени администратора, если скрипт запущен не от имени администратора, то скрипт не будет работать 

@echo off
echo.
call :USER_DEFINED
REM Set processor affinities; if not set, leave as is
:processaffinity
REM CREDIT TO SPDLL for the fastest code
if defined affinity (
    if not %affinity% GTR 0 goto INVALID_AFFINITY
    PowerShell -NoLogo -NoProfile -NonInteractive -Command "Get-Process dwm,audiosvchost,audiodg,lsass,svchost,WmiPrvSE | ForEach-Object {$_.ProcessorAffinity=%affinity%}"
)
:INVALID_AFFINITY
REM Set winlogon to normal priority to prevent child processes from inheriting high priority
wmic process where name="winlogon.exe" call setpriority 32 >nul 2>&1
REM Clear temporary files
rd /s /q "%temp%" 2>nul
mkdir "%userprofile%\AppData\Local\Temp" >nul 2>&1
exit /b

:USER_DEFINED
wmic process where name="dwm.exe" call setpriority 32 >nul 2>&1
wmic process where name="lsass.exe" call setpriority 64 >nul 2>&1
wmic process where name="svchost.exe" call setpriority 64 >nul 2>&1
wmic process where name="WmiPrvSE.exe" call setpriority 64 >nul 2>&1
@echo off
REM Set encoding and disable command displa
chcp 65001 >nul
cls
title Windows Optimization by Doxile
REM Color codes
REM 0 = Black 1 = Blue 2 = Green
REM 3 = Aqua 4 = Red 5 = Purple
REM 6 = Yellow 7 = White 8 = Gray
REM 9 = Light Blue 10 = Light Green, etc.
set "COLOR_TITLE=0A"
set "COLOR_MENU=0E"
set "COLOR_ERROR=0C"
set "COLOR_SUCCESS=0A"
set "COLOR_PROMPT=0B"
REM Number of optimizations applied
set "optimization_count=60"  REM Увеличено количество оптимизаций
REM Function to display menu
:menu
cls
echo  °º¤ø,¸¸,ø¤º°`°º¤ø,¸,ø¤°º¤ø,¸¸,ø¤º°`°º¤ø,¸,ø¤°º¤ø,¸¸,ø¤º°`°º¤ø,¸,ø¤°º¤ø,¸¸,ø¤º°,ø¤°º¤ø,¸¸,ø¤º°
echo.
echo      Windows Optimization by Doxile
echo      Total optimizations in the script: %optimization_count%
echo.
echo  °º¤ø,¸¸,ø¤º°`°º¤ø,¸,ø¤°º¤ø,¸¸,ø¤º°`°º¤ø,¸,ø¤°º¤ø,¸¸,ø¤º°`°º¤ø,¸,ø¤°º¤ø,¸¸,ø¤º°,ø¤°º¤ø,¸¸,ø¤º°
echo.
echo        1. Apply Windows Optimizations
echo        2. Restore Default Settings
echo        3. Enable Windows Boost
echo        4. Disable Windows Boost
echo        5. Clean Disk and Temporary Files
echo        6. Update System Files and Drivers
echo        7. Create Restore Point
echo        8. Optimize Network Settings
echo        0. Exit
echo.
echo  °º¤ø,¸¸,ø¤º°`°º¤ø,¸,ø¤°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸,ø¤°º¤ø,¸¸,ø¤º°`°º¤ø,¸,ø¤°º¤ø,¸¸,ø¤º°
echo.
REM Prompt user for choice
color %COLOR_PROMPT%
set /p "choice=Enter your choice: "
color 07
REM Handle user choice
if "%choice%"=="1" goto optimizations
if "%choice%"=="2" goto restore_defaults
if "%choice%"=="3" goto boost_enable
if "%choice%"=="4" goto boost_disable
if "%choice%"=="5" goto clean_disk
if "%choice%"=="6" goto update_system
if "%choice%"=="7" goto create_restore
if "%choice%"=="8" goto optimize_network
if "%choice%"=="0" goto exit_script
echo.
color %COLOR_ERROR%
echo Invalid selection. Please try again.
color 07
timeout /t 2 /nobreak >nul
goto menu

REM Optimization Function
:optimizations
cls
color %COLOR_MENU%
echo.
echo Applying Windows optimizations...
echo.
REM Stop unnecessary services
echo Stopping unnecessary services...
net stop "SysMain" >nul 2>&1
net stop "Superfetch" >nul 2>&1
net stop "Print Spooler" >nul 2>&1
net stop "Fax" >nul 2>&1
net stop "wuauserv" >nul 2>&1
net stop "BITS" >nul 2>&1
net stop "WMPNetworkSvc" >nul 2>&1
net stop "ConnectedUserSharedExperiences_32771" >nul 2>&1
net stop "Spooler" >nul 2>&1
REM Remove programs from startup
echo.
echo Cleaning startup...
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /f >nul 2>&1
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /f >nul 2>&1
REM Optimize visual effects
echo.
echo Optimizing visual effects...
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" /v VisualFXSetting /t REG_DWORD /d 2 /f >nul
reg add "HKCU\SOFTWARE\Microsoft\Windows\DWM" /v EnableTransparency /t REG_DWORD /d 0 /f >nul
REM Disable hibernation and other features
echo.
echo Disabling hibernation and search features...
powercfg /hibernate off >nul 2>&1
sc config "Windows Search" start=disabled >nul 2>&1
sc config "SysMain" start=disabled >nul 2>&1
REM Disable Game DVR and Delivery Optimization
echo.
echo Disabling Game DVR and Delivery Optimization...
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\GameDVR" /v AllowGameDVR /t REG_DWORD /d 0 /f >nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization" /v DODownloadMode /t REG_DWORD /d 0 /f >nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization" /v DOUploadMode /t REG_DWORD /d 0 /f >nul
REM Disable background tasks
echo.
echo Disabling scheduled tasks...
for %%a in (
    "Microsoft\Windows\Defrag\ScheduledDefrag"
    "Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser"
    "Microsoft\Windows\Application Experience\ProgramDataUpdater"
    "Microsoft\Windows\Application Experience\StartupAppTask"
    "Microsoft\Windows\Device Information\Device"
    "Microsoft\Windows\Diagnosis\Scheduled"
    "Microsoft\Windows\Diagnosis\RecommendedTroubleshootingScanner"
    "Microsoft\Windows\DiskFootprint\Diagnostics"
    "Microsoft\Windows\DiskFootprint\StorageSense"
    "Microsoft\Windows\Feedback\Siuf\DmClientOnScenarioDownload"
    "Microsoft\Windows\Feedback\Siuf\DmClient"
    "Microsoft\Windows\International\Synchronize Language Settings"
    "Microsoft\Windows\LanguageComponentsInstaller\Installation"
    "Microsoft\Windows\LanguageComponentsInstaller\ReconcileLanguageResources"
    "Microsoft\Windows\Maps\MapsUpdateTask"
    "Microsoft\Windows\Maps\MapsToastTask"
    "Microsoft\Windows\PushToInstall\Registration"
    "Microsoft\Windows\Setup\SetupCleanupTask"
    "Microsoft\Windows\Speech\SpeechModelDownloadTask"
    "Microsoft\Windows\Windows Error Reporting\QueueReporting"
    "Microsoft\Windows\WindowsColorSystem\Calibration Loader"
    "Microsoft\Windows\Work Folders\Work Folders Logon Synchronization"
    "Microsoft\Windows\MemoryDiagnostic\ProcessMemoryDiagnosticEvents"
    "Microsoft\Windows\MemoryDiagnostic\RunFullMemoryDiagnostic"
) do schtasks /change /tn "%%a" /disable >nul 2>&1
REM Optimize power and performance settings
echo.
echo Optimizing power and performance settings...
powercfg /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c >nul 2>&1
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\PriorityControl" /v "Win32PrioritySeparation" /t REG_DWORD /d 38 /f >nul
REM Set process priorities
echo.
echo Setting process priorities...
for %%P in ("BstkSVC.exe" "HD-Agent.exe" "HD-Player.exe" "BlueStacks.exe") do (
    reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\%%~P\PerfOptions" /v "CpuPriorityClass" /t REG_DWORD /d 3 /f >nul
)
REM Optimize multimedia profiles
echo.
echo Optimizing multimedia profiles...
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games" /v "GPU Priority" /t REG_DWORD /d 8 /f >nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games" /v "Priority" /t REG_DWORD /d 6 /f >nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games" /v "Scheduling Category" /t REG_SZ /d "High" /f >nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games" /v "SFIO Priority" /t REG_SZ /d "High" /f >nul
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerThrottling" /v "PowerThrottlingOff" /t REG_DWORD /d 1 /f >nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile" /v "SystemResponsiveness" /t REG_DWORD /d 0 /f >nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile" /v "NetworkThrottlingIndex" /t REG_DWORD /d 0xffffffff /f >nul
REM Configure USB settings for performance
echo.
echo Configuring USB settings...
for /f "tokens=2 delims==" %%a in ('WMIC PATH Win32_USBHub GET DeviceID /VALUE ^| find "="') do (
    for %%b in ("EnhancedPowerManagementEnabled" "AllowIdleIrpInD3" "SelectiveSuspendOn" "DeviceSelectiveSuspended" "SelectiveSuspendEnabled") do (
        reg add "HKLM\SYSTEM\CurrentControlSet\Enum\%%a\Device Parameters" /v "%%~b" /t REG_DWORD /d 0 /f >nul 2>&1
    )
)
REM Disable Game Bar and game settings
echo.
echo Disabling Game Bar and game settings...
reg add "HKCU\SOFTWARE\Microsoft\GameBar" /v "ShowStartupPanel" /t REG_DWORD /d 0 /f >nul
reg add "HKCU\SOFTWARE\Microsoft\GameBar" /v "GamePanelStartupTipIndex" /t REG_DWORD /d 3 /f >nul
reg add "HKCU\SOFTWARE\Microsoft\GameBar" /v "AllowAutoGameMode" /t REG_DWORD /d 0 /f >nul
reg add "HKCU\SOFTWARE\Microsoft\GameBar" /v "AutoGameModeEnabled" /t REG_DWORD /d 0 /f >nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\GameDVR" /v "AllowGameDVR" /t REG_DWORD /d 0 /f >nul
reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR" /v "AppCaptureEnabled" /t REG_DWORD /d 0 /f >nul
REM Additional optimizations
echo.
echo Applying additional optimizations...
REM Disable search indexing
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "GatherSystemTags" /t REG_DWORD /d 0 /f >nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "GatherExtendedProperties" /t REG_DWORD /d 0 /f >nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "IndexingPaused" /t REG_DWORD /d 1 /f >nul
REM Disable notifications
reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications" /v "ToastEnabled" /t REG_DWORD /d 0 /f >nul
reg add "HKCU\Software\Policies\Microsoft\Windows\Explorer" /v "DisableNotificationCenter" /t REG_DWORD /d 1 /f >nul
REM Disable Windows advertising elements
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SystemPaneSuggestionsEnabled" /t REG_DWORD /d 0 /f >nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-338388Enabled" /t REG_DWORD /d 0 /f >nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-338389Enabled" /t REG_DWORD /d 0 /f >nul
REM Disable telemetry
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v "AllowTelemetry" /t REG_DWORD /d 0 /f >nul
REM Disable background applications
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications" /v "GlobalUserDisabled" /t REG_DWORD /d 1 /f >nul
REM Disable automatic driver updates
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\DriverSearching" /v "SearchOrderConfig" /t REG_DWORD /d 0 /f >nul
REM Disable automatic Windows updates
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f >nul
REM Configure virtual memory settings
echo.
echo Configuring virtual memory settings...
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v "PagingFiles" /t REG_MULTI_SZ /d "C:\pagefile.sys 4096 8192" /f >nul
REM Optimize registry for faster startup
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Serialize" /v "StartupDelayInMSec" /t REG_DWORD /d 0 /f >nul
REM Clean prefetch and temporary files
echo.
echo Cleaning temporary files and prefetch data...
del /f /s /q C:\Windows\Prefetch\* >nul 2>&1
del /f /s /q %TEMP%\* >nul 2>&1
del /f /s /q C:\Windows\Temp\* >nul 2>&1
REM Additional optimizations (additional steps)
echo.
echo Applying additional optimizations (additional steps)...
REM Step 1: Disable UAC and SmartScreen
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "EnableLUA" /t REG_DWORD /d 0 /f >nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "PromptOnSecureDesktop" /t REG_DWORD /d 0 /f >nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "ConsentPromptBehaviorAdmin" /t REG_DWORD /d 0 /f >nul
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" /v SmartScreenEnabled /t REG_SZ /d "Off" /f >nul
REM Step 2: Disable CPU reserve for background processes
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile" /v "SystemResponsiveness" /t REG_DWORD /d 0a /f >nul
REM Step 3: Configure NetworkThrottlingIndex
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile" /v "NetworkThrottlingIndex" /t REG_DWORD /d 0a /f >nul
REM Step 4: Disable Store app auto-updates
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsStore" /v "AutoDownload" /t REG_DWORD /d 2 /f >nul
REM Step 5: Reduce timeout durations
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v "AutoEndTasks" /t REG_SZ /d "1" /f >nul
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v "HungAppTimeout" /t REG_SZ /d "1000" /f >nul
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v "WaitToKillAppTimeout" /t REG_SZ /d "2000" /f >nul
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v "LowLevelHooksTimeout" /t REG_SZ /d "1000" /f >nul
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v "MenuShowDelay" /t REG_SZ /d "0" /f >nul
REM Step 6: Set desktop background quality
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v "JPEGImportQuality" /t REG_DWORD /d 80 /f >nul
REM Step 7: Increase system cache
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Memory Management" /v "LargeSystemCache" /t REG_DWORD /d 1 /f >nul
REM Step 8: Reduce shutdown timeout
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control" /v "WaitToKillServiceTimeout" /t REG_SZ /d "10000" /f >nul
REM Step 9: Disable additional scheduled tasks
call :disable_additional_tasks
REM Step 10: Disable unnecessary devices using DevManView
call :disable_devices
REM Step 11: Disable more scheduled tasks
call :disable_more_tasks
REM Step 12: Configure OpenGL
call :configure_opengl
REM Step 13: Additional OpenGL settings
call :additional_opengl_settings
REM Step 14: Set GPU environment variables
call :set_gpu_env
REM Step 15: Protect OpenGL DLL
call :protect_opengl
REM Step 16: Disable Remote Registry Service
echo.
echo Disabling Remote Registry Service...
sc config "RemoteRegistry" start=disabled >nul 2>&1
sc stop "RemoteRegistry" >nul 2>&1
REM Step 17: Disable Windows Tips
echo.
echo Disabling Windows Tips...
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-338389Enabled" /t REG_DWORD /d 0 /f >nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-338384Enabled" /t REG_DWORD /d 0 /f >nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-338387Enabled" /t REG_DWORD /d 0 /f >nul
REM Step 18: Disable Transparency Effects
echo.
echo Disabling Transparency Effects...
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "EnableTransparency" /t REG_DWORD /d 0 /f >nul
REM Step 19: Disable Animations
echo.
echo Disabling Window Animations...
reg add "HKCU\Control Panel\Desktop" /v "WindowAnimation" /t REG_SZ /d "0" /f >nul
reg add "HKCU\Control Panel\Desktop" /v "MinAnimate" /t REG_SZ /d "0" /f >nul
REM Step 20: Disable Shake Window Effect
echo.
echo Disabling Shake Window Effect...
reg add "HKCU\Control Panel\Desktop" /v "ClientVisualStylePrefe" /t REG_SZ /d "0" /f >nul
reg add "HKCU\Control Panel\Desktop" /v "WindowArrangementActive" /t REG_SZ /d "0" /f >nul
REM Finish optimizations
echo.
color %COLOR_SUCCESS%
echo Optimizations successfully applied!
color 07
timeout /t 3 /nobreak >nul
goto menu

REM Function to disable additional tasks (Step 9)
:disable_additional_tasks
echo.
echo Disabling additional scheduled tasks (Step 9)...
REM Insert user step 9 commands here
schtasks /change /TN "Microsoft\Windows\.NET Framework\.NET Framework NGEN v4.0.30319" /DISABLE >nul 2>&1
schtasks /change /TN "Microsoft\Windows\.NET Framework\.NET Framework NGEN v4.0.30319 64" /DISABLE >nul 2>&1
schtasks /change /TN "Microsoft\Windows\.NET Framework\.NET Framework NGEN v4.0.30319 64 Critical" /DISABLE >nul 2>&1
schtasks /change /TN "Microsoft\Windows\.NET Framework\.NET Framework NGEN v4.0.30319 Critical" /DISABLE >nul 2>&1
schtasks /change /TN "Microsoft\Windows\ApplicationData\appuriverifierdaily" /DISABLE >nul 2>&1
schtasks /change /TN "Microsoft\Windows\ApplicationData\appuriverifierinstall" /DISABLE >nul 2>&1
schtasks /Change /TN "Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" /DISABLE >nul 2>&1
schtasks /Change /TN "Microsoft\Windows\Application Experience\ProgramDataUpdater" /DISABLE >nul 2>&1
schtasks /Change /TN "Microsoft\Windows\Application Experience\StartupAppTask" /DISABLE >nul 2>&1
schtasks /change /TN "Microsoft\Windows\Device Information\Device" /DISABLE >nul 2>&1
schtasks /change /TN "Microsoft\Windows\Diagnosis\Scheduled" /DISABLE >nul 2>&1
schtasks /change /TN "Microsoft\Windows\Diagnosis\RecommendedTroubleshootingScanner" /DISABLE >nul 2>&1
schtasks /change /TN "Microsoft\Windows\DiskFootprint\Diagnostics" /DISABLE >nul 2>&1
schtasks /change /TN "Microsoft\Windows\DiskFootprint\StorageSense" /DISABLE >nul 2>&1
schtasks /change /TN "Microsoft\Windows\Feedback\Siuf\DmClientOnScenarioDownload" /DISABLE >nul 2>&1
schtasks /change /TN "Microsoft\Windows\Feedback\Siuf\DmClient" /DISABLE >nul 2>&1
schtasks /change /TN "Microsoft\Windows\International\Synchronize Language Settings" /DISABLE >nul 2>&1
schtasks /change /TN "Microsoft\Windows\LanguageComponentsInstaller\Installation" /DISABLE >nul 2>&1
schtasks /change /TN "Microsoft\Windows\LanguageComponentsInstaller\ReconcileLanguageResources" /DISABLE >nul 2>&1
schtasks /change /TN "Microsoft\Windows\Maps\MapsUpdateTask" /DISABLE >nul 2>&1
schtasks /Change /TN "Microsoft\Windows\Maps\MapsToastTask" /DISABLE >nul 2>&1
schtasks /change /TN "Microsoft\Windows\PushToInstall\Registration" /DISABLE >nul 2>&1
schtasks /change /TN "Microsoft\Windows\Setup\SetupCleanupTask" /DISABLE >nul 2>&1
schtasks /change /TN "Microsoft\Windows\Speech\SpeechModelDownloadTask" /DISABLE >nul 2>&1
schtasks /change /TN "Microsoft\Windows\Windows Error Reporting\QueueReporting" /DISABLE >nul 2>&1
schtasks /change /TN "Microsoft\Windows\WindowsColorSystem\Calibration Loader" /DISABLE >nul 2>&1
schtasks /change /TN "Microsoft\Windows\Work Folders\Work Folders Logon Synchronization" /DISABLE >nul 2>&1
echo Additional tasks disabled successfully!
goto :eof

REM Function to disable devices using DevManView (Step 10)
:disable_devices
echo.
echo Disabling unnecessary devices (Step 10)...
REM Ensure DevManView.exe is in the same directory as the script
if not exist "%cd%\devmanview\devmanview.exe" (
    echo DevManView.exe not found. Skipping device disabling.
    goto :eof
)
"%cd%\devmanview\devmanview.exe" /disable "UMBus Root Bus Enumerator" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "Root Print Queue" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "NDIS Virtual Network Adapter Enumerator" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "Microsoft Virtual Drive Enumerator" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "Microsoft Hyper-V Virtualization Infrastructure Driver" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "Microsoft GS Wavetable Synth" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "Microsoft Device Association Root Enumerator" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "Composite Bus Enumerator" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "Microsoft UEFI-Compliant System" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "System board" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "SM Bus Controller" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "Motherboard resources" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "PCI Encryption/Decryption Controller" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "Microsoft Windows Management Interface for ACPI" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "High precision event timer" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "Base System Device" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "PCI Data Acquisition and Signal Processing Controller" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "PCI Simple Communications Controller" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "PCI Device" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "Unknown Device" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "PCI Memory Controller" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "PCI standard RAM Controller" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "ACPI Processor Aggregator" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "ACPI Wake Alarm" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "System Speaker" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "System Timer" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "WAN Miniport (IKEv2)" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "WAN Miniport (IP)" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "WAN Miniport (IPv6)" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "WAN Miniport (L2TP)" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "WAN Miniport (Network Monitor)" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "WAN Miniport (PPPOE)" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "WAN Miniport (PPTP)" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "WAN Miniport (SSTP)" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "Programmable Interrupt Controller" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "Numeric Data Processor" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "Microsoft Kernel Debug Network Adapter" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "HID-compliant consumer control device" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "Plug and Play Software Device Enumerator" >nul 2>&1
"%cd%\devmanview\devmanview.exe" /disable "Direct memory access controller" >nul 2>&1
echo Devices disabled successfully!
goto :eof

REM Function to disable more scheduled tasks (Step 11)
:disable_more_tasks
echo.
echo Disabling additional scheduled tasks (Step 11)...
REM Insert step 11 commands here
schtasks /Change /Disable /TN "\MicrosoftEdgeUpdateTaskMachineCore" >nul 2>&1
schtasks /Change /Disable /TN "\MicrosoftEdgeUpdateTaskMachineUA" >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\Power Efficiency Diagnostics\AnalyzeSystem" >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\Windows Error Reporting\QueueReporting" >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\DiskFootprint\Diagnostics" >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\Application Experience\StartupAppTask" >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\Autochk\Proxy" >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\Application Experience\PcaPatchDbTask" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\BrokerInfrastructure\BgTaskRegistrationMaintenanceTask" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\CloudExperienceHost\CreateObjectTask" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\DiskDiagnostic\Microsoft-Windows-DiskDiagnosticDataCollector" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\Defrag\ScheduledDefrag" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\DiskFootprint\StorageSense" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\MicrosoftEdgeUpdateBrowserReplacementTask" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\Registry\RegIdleBackup" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\Windows Filtering Platform\BfeOnServiceStartTypeChange" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\Shell\IndexerAutomaticMaintenance" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTaskNetwork" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\SoftwareProtectionPlatform\SvcRestartTaskLogon" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\StateRepository\MaintenanceTasks" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\UpdateOrchestrator\Report policies" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\UpdateOrchestrator\Schedule Scan Static Task" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\UpdateOrchestrator\UpdateModelTask" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\UpdateOrchestrator\USO_UxBroker" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\UpdateOrchestrator\Schedule Work" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\UPnP\UPnPHostConfig" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\RetailDemo\CleanupOfflineContent" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\Shell\FamilySafetyMonitor" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\InstallService\ScanForUpdates" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\InstallService\ScanForUpdatesAsUser" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\InstallService\SmartRetry" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\International\Synchronize Language Settings" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\MemoryDiagnostic\ProcessMemoryDiagnosticEvents" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\MemoryDiagnostic\RunFullMemoryDiagnostic" >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\Multimedia\Microsoft\Windows\Multimedia" >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\Printing\EduPrintProv" >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\RemoteAssistance\RemoteAssistanceTask" >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\Ras\MobilityManager" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\PushToInstall\LoginCheck" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\Time Synchronization\SynchronizeTime" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\Time Synchronization\ForceSynchronizeTime" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\Time Zone\SynchronizeTimeZone" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\UpdateOrchestrator\Schedule Scan" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\WaaSMedic\PerformRemediation" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\DiskCleanup\SilentCleanup" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\Diagnosis\Scheduled" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\Wininet\CacheTask" /DISABLE >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\Device Setup\Metadata Refresh" >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\Mobile Broadband Accounts\MNO Metadata Parser" >nul 2>&1
schtasks /Change /Disable /TN "\Microsoft\Windows\WindowsUpdate\Scheduled Start" /DISABLE >nul 2>&1
echo.
goto :eof

REM Function to configure OpenGL (Step 12)
:configure_opengl
echo.
echo Configuring OpenGL (Step 12)...
REM Example OpenGL configuration adjusted for Batch
set "OPENGL_32=%windir%\system32\opengl32.dll"
set "OPENGL_DEBUG=1"
echo OPENGL_32="%OPENGL_32%"
echo OPENGL_DEBUG="%OPENGL_DEBUG%"
REM Add additional commands here if necessary
goto :eof

REM Function for additional OpenGL settings (Step 13)
:additional_opengl_settings
echo.
echo Applying additional OpenGL settings (Step 13)...
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOpenGL" /v "DisableAsync" /t REG_DWORD /d 1 /f >nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOpenGL" /v "EnableMultisampleBuffers" /t REG_DWORD /d 1 /f >nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOpenGL" /v "EnableSurfaceMemoryManagement" /t REG_DWORD /d 1 /f >nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOpenGL" /v "MaxWGLSwapInterval" /t REG_DWORD /d 1 /f >nul
goto :eof

REM Function to set GPU environment variables (Step 14)
:set_gpu_env
echo.
echo Setting GPU environment variables (Step 14)...
setx GPU_MAX_HEAP_SIZE 100 >nul
setx GPU_MAX_ALLOC_PERCENT 100 >nul
setx GPU_SINGLE_ALLOC_PERCENT 100 >nul
goto :eof

REM Function to protect OpenGL DLL (Step 15)
:protect_opengl
echo.
echo Protecting OpenGL DLL (Step 15)...
set "OPENGL_32_DLL=%windir%\System32\opengl32.dll"
set "OPENGL_32_DLL_SIZE=2576980377"
if exist "%OPENGL_32_DLL%.bak" (
    echo Backup already exists.
) else (
    copy "%OPENGL_32_DLL%" "%OPENGL_32_DLL%.bak" >nul 2>&1
    fsutil file setvaliddata "%OPENGL_32_DLL%" %OPENGL_32_DLL_SIZE% >nul 2>&1
)
goto :eof

REM Function to enable Windows Boost
:boost_enable
cls
echo Enabling Windows Boost...
color %COLOR_MENU%
echo.
REM Apply high-performance mode
powercfg -setactive SCHEME_MIN >nul 2>&1
REM Terminate explorer.exe process
taskkill /f /im explorer.exe >nul 2>&1
REM Additional Boost optimizations
echo.
echo Applying additional Boost settings...
REM Increase process priorities
wmic process where name="chrome.exe" call setpriority 128 >nul 2>&1
wmic process where name="firefox.exe" call setpriority 128 >nul 2>&1
REM Disable visual effects for speed
reg add "HKCU\Control Panel\Desktop" /v "WindowAnimation" /t REG_SZ /d "0" /f >nul
reg add "HKCU\Control Panel\Desktop" /v "MinAnimate" /t REG_SZ /d "0" /f >nul
REM Enable maximum graphics performance (for systems with discrete graphics)
echo.
echo Configuring graphics settings for maximum performance...
reg add "HKCU\Software\Microsoft\DirectDraw\Renderer" /v "DefaultAdapter" /t REG_DWORD /d 0 /f >nul
reg add "HKCU\Software\Microsoft\DirectDraw\Renderer" /v "UseHardware" /t REG_DWORD /d 1 /f >nul
REM Disable background services
echo.
echo Disabling background services...
sc stop "DiagTrack" >nul 2>&1
sc config "DiagTrack" start=disabled >nul 2>&1
sc stop "WerSvc" >nul 2>&1
sc config "WerSvc" start=disabled >nul 2>&1
REM Disable unnecessary Windows features
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoWindowsUpdate" /t REG_DWORD /d 1 /f >nul
REM Disable Windows Tips and Notifications
echo.
echo Disabling Windows Tips and Notifications...
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SystemPaneSuggestionsEnabled" /t REG_DWORD /d 0 /f >nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-338389Enabled" /t REG_DWORD /d 0 /f >nul
REM Finish Boost
echo.
color %COLOR_SUCCESS%
echo Windows Boost enabled and optimizations applied!
color 07
timeout /t 3 /nobreak >nul
goto menu

REM Function to disable Windows Boost
:boost_disable
cls
echo Disabling Windows Boost...
color %COLOR_MENU%
echo.
REM Return to balanced power plan
powercfg -setactive SCHEME_BALANCED >nul 2>&1
REM Start explorer.exe process
start explorer.exe >nul 2>&1
REM Restore visual effects
echo.
echo Restoring visual settings...
reg add "HKCU\Control Panel\Desktop" /v "WindowAnimation" /t REG_SZ /d "1" /f >nul
reg add "HKCU\Control Panel\Desktop" /v "MinAnimate" /t REG_SZ /d "1" /f >nul
REM Restore process priorities
wmic process where name="chrome.exe" call setpriority 32 >nul 2>&1
wmic process where name="firefox.exe" call setpriority 32 >nul 2>&1
REM Restore graphics settings
reg delete "HKCU\Software\Microsoft\DirectDraw\Renderer" /v "DefaultAdapter" /f >nul 2>&1
reg delete "HKCU\Software\Microsoft\DirectDraw\Renderer" /v "UseHardware" /f >nul 2>&1
REM Enable background services
echo.
echo Enabling background services...
sc config "DiagTrack" start=delayed-auto >nul 2>&1
sc start "DiagTrack" >nul 2>&1
sc config "WerSvc" start=delayed-auto >nul 2>&1
sc start "WerSvc" >nul 2>&1
REM Restore Windows Update settings
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoWindowsUpdate" /f >nul 2>&1
REM Restore Windows Tips and Notifications
echo.
echo Restoring Windows Tips and Notifications...
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SystemPaneSuggestionsEnabled" /f >nul 2>&1
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-338389Enabled" /f >nul 2>&1
REM Restore OpenGL settings
echo.
echo Restoring OpenGL settings...
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOpenGL" /v "DisableAsync" /f >nul 2>&1
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOpenGL" /v "EnableMultisampleBuffers" /f >nul 2>&1
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOpenGL" /v "EnableSurfaceMemoryManagement" /f >nul 2>&1
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOpenGL" /v "MaxWGLSwapInterval" /f >nul 2>&1
REM Restore GPU environment variables
echo.
echo Restoring GPU environment variables...
setx GPU_MAX_HEAP_SIZE 50 >nul
setx GPU_MAX_ALLOC_PERCENT 50 >nul
setx GPU_SINGLE_ALLOC_PERCENT 50 >nul
REM Restore OpenGL DLL from backup
echo.
echo Restoring OpenGL DLL from backup...
if exist "%windir%\System32\opengl32.dll.bak" (
    copy /Y "%windir%\System32\opengl32.dll.bak" "%windir%\System32\opengl32.dll" >nul 2>&1
) else (
    echo OpenGL DLL backup not found.
)
REM Delete backup
del "%windir%\System32\opengl32.dll.bak" >nul 2>&1
REM Finish Boost
echo.
color %COLOR_SUCCESS%
echo Windows Boost disabled and settings restored!
color 07
timeout /t 3 /nobreak >nul
goto menu

REM Function to clean disk and temporary files
:clean_disk
cls
echo Cleaning disk and temporary files...
color %COLOR_MENU%
echo.
REM Use built-in Disk Cleanup
echo Running Disk Cleanup...
cleanmgr /sagerun:1 >nul 2>&1
REM Alternatively, you can use commands to clean
REM echo.
REM echo Cleaning temporary files...
REM del /f /s /q %TEMP%\* >nul 2>&1
REM del /f /s /q C:\Windows\Temp\* >nul 2>&1
REM echo Clearing prefetch data...
REM del /f /s /q C:\Windows\Prefetch\* >nul 2>&1
echo.
color %COLOR_SUCCESS%
echo Cleaning completed.
color 07
timeout /t 3 /nobreak >nul
goto menu

REM Function to update system files and drivers
:update_system
cls
echo Updating system files and drivers...
color %COLOR_MENU%
echo.
REM Check and restore system files
echo Running system file check (sfc /scannow)...
sfc /scannow >nul 2>&1
echo.
echo Restoring system components (DISM)...
DISM /Online /Cleanup-Image /RestoreHealth >nul 2>&1
REM Update drivers via Windows Update
echo.
echo Updating drivers via Windows Update...
powershell -Command "Install-Module PSWindowsUpdate -Force -SkipPublisherCheck" >nul 2>&1
powershell -Command "Import-Module PSWindowsUpdate" >nul 2>&1
powershell -Command "Get-WindowsUpdate -MicrosoftUpdate -AcceptAll -Install -AutoReboot" >nul 2>&1
echo.
color %COLOR_SUCCESS%
echo System files and drivers updated successfully.
color 07
timeout /t 5 /nobreak >nul
goto menu

REM Function to create a system restore point
:create_restore
cls
echo Creating a system restore point...
color %COLOR_MENU%
echo.
REM Check if system restore is enabled
powershell -Command "Checkpoint-Computer -Description 'Manual Restore Point' -RestorePointType 'MODIFY_SETTINGS'" >nul 2>&1
if %ERRORLEVEL% EQU 0 (
    echo Restore point created successfully.
) else (
    echo Failed to create restore point. Ensure that the "System Protection" service is running.
)
echo.
color %COLOR_SUCCESS%
timeout /t 3 /nobreak >nul
color 07
goto menu

REM Function to restore default settings
:restore_defaults
cls
echo Restoring default settings...
color %COLOR_MENU%
echo.
REM Restore UAC and SmartScreen settings
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "EnableLUA" /f >nul 2>&1
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "PromptOnSecureDesktop" /f >nul 2>&1
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "ConsentPromptBehaviorAdmin" /f >nul 2>&1
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" /v SmartScreenEnabled /t REG_SZ /d "Warn" /f >nul
REM Restore CPU reserve for background processes
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile" /v "SystemResponsiveness" /t REG_DWORD /d 10 /f >nul
REM Restore NetworkThrottlingIndex
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile" /v "NetworkThrottlingIndex" /t REG_DWORD /d 0xFFFFFFFF /f >nul
REM Enable Store app auto-updates
reg delete "HKLM\SOFTWARE\Policies\Microsoft\WindowsStore" /v "AutoDownload" /f >nul 2>&1
REM Restore timeout durations
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v "AutoEndTasks" /t REG_SZ /d "0" /f >nul
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v "HungAppTimeout" /t REG_SZ /d "5000" /f >nul
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v "WaitToKillAppTimeout" /t REG_SZ /d "4000" /f >nul
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v "LowLevelHooksTimeout" /t REG_SZ /d "2000" /f >nul
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v "MenuShowDelay" /t REG_SZ /d "400" /f >nul
REM Restore desktop background quality
reg delete "HKEY_CURRENT_USER\Control Panel\Desktop" /v "JPEGImportQuality" /f >nul 2>&1
REM Restore system cache
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Memory Management" /v "LargeSystemCache" /t REG_DWORD /d 0 /f >nul
REM Restore shutdown timeout
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control" /v "WaitToKillServiceTimeout" /t REG_SZ /d "12000" /f >nul
REM Enable scheduled tasks
echo.
echo Enabling scheduled tasks...
REM Example of enabling some tasks; add others similarly
schtasks /change /TN "Microsoft\Windows\Defrag\ScheduledDefrag" /enable >nul 2>&1
schtasks /change /TN "Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" /enable >nul 2>&1
REM Restore graphics settings
reg delete "HKCU\Software\Microsoft\DirectDraw\Renderer" /v "DefaultAdapter" /f >nul 2>&1
reg delete "HKCU\Software\Microsoft\DirectDraw\Renderer" /v "UseHardware" /f >nul 2>&1
REM Enable background services
echo.
echo Enabling background services...
sc config "DiagTrack" start=delayed-auto >nul 2>&1
sc start "DiagTrack" >nul 2>&1
sc config "WerSvc" start=delayed-auto >nul 2>&1
sc start "WerSvc" >nul 2>&1
REM Restore Windows Update settings
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoWindowsUpdate" /f >nul 2>&1
REM Restore Windows Tips and Notifications
echo.
echo Restoring Windows Tips and Notifications...
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SystemPaneSuggestionsEnabled" /f >nul 2>&1
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-338389Enabled" /f >nul 2>&1
REM Restore OpenGL settings
echo.
echo Restoring OpenGL settings...
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOpenGL" /v "DisableAsync" /f >nul 2>&1
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOpenGL" /v "EnableMultisampleBuffers" /f >nul 2>&1
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOpenGL" /v "EnableSurfaceMemoryManagement" /f >nul 2>&1
reg delete "HKEY_LOCAL_MACHINE\S

WARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOpenGL" /v "MaxWGLSwapInterval" /f >nul 2>&1
REM Restore GPU environment variables
echo.
echo Restoring GPU environment variables...
setx GPU_MAX_HEAP_SIZE 50 >nul
setx GPU_MAX_ALLOC_PERCENT 50 >nul
setx GPU_SINGLE_ALLOC_PERCENT 50 >nul
REM Restore OpenGL DLL from backup
echo.
echo Restoring OpenGL DLL from backup...
if exist "%windir%\System32\opengl32.dll.bak" (
    copy /Y "%windir%\System32\opengl32.dll.bak" "%windir%\System32\opengl32.dll" >nul 2>&1
) else (
    echo OpenGL DLL backup not found.
)
REM Delete backup
del "%windir%\System32\opengl32.dll.bak" >nul 2>&1
REM Finish restoration
echo.
color %COLOR_SUCCESS%
echo Default settings restored successfully!
color 07
timeout /t 3 /nobreak >nul
goto menu

REM Function to disable Cortana
:disable_cortana
cls
echo Disabling Cortana...
color %COLOR_MENU%
echo.
REM Disable Cortana via Registry
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowCortana" /t REG_DWORD /d 0 /f >nul
REM Stop Cortana process
taskkill /F /IM "SearchUI.exe" >nul 2>&1
REM Disable Cortana startup
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /v "Cortana" /t REG_SZ /d "\"%windir%\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\SearchUI.exe\"" /f >nul
echo.
color %COLOR_SUCCESS%
echo Cortana has been disabled successfully!
color 07
timeout /t 3 /nobreak >nul
goto menu

REM Function to optimize network settings
:optimize_network
cls
echo Optimizing network settings...
color %COLOR_MENU%
echo.
REM Disable Windows Auto-Tuning
netsh interface tcp set global autotuninglevel=disabled >nul 2>&1
REM Enable TCP Fast Open
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "TCPFastOpen" /t REG_DWORD /d 1 /f >nul
REM Disable Nagle's Algorithm
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces" /v "DisableNodeNameRelease" /t REG_DWORD /d 1 /f >nul
REM Optimize MTU size
netsh interface ipv4 set subinterface "Ethernet" mtu=1472 store=persistent >nul 2>&1
netsh interface ipv6 set subinterface "Ethernet" mtu=1472 store=persistent >nul 2>&1
REM Flush DNS Cache
ipconfig /flushdns >nul 2>&1
REM Reset TCP/IP stack
netsh int ip reset >nul 2>&1
REM Disable IPv6 (если не используется)
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters" /v "DisabledComponents" /t REG_DWORD /d 0xff /f >nul
REM Enable Quality of Service (QoS)
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "EnablePMTUDiscovery" /t REG_DWORD /d 1 /f >nul
REM Finish Network Optimization
echo.
color %COLOR_SUCCESS%
echo Network settings optimized successfully!
color 07
timeout /t 3 /nobreak >nul
goto menu

REM Function to exit the script
:exit_script
cls
echo Exiting the script...
color %COLOR_MENU%
echo.
color %COLOR_SUCCESS%
echo Thank you for using the Windows Optimization by Doxile!
color 07
timeout /t 2 /nobreak >nul
exit

REM Function to add the script to startup
:add_autostart
cls
echo Adding optimization to startup...
color %COLOR_MENU%
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /v "WindowsOptimization" /t REG_SZ /d "\"%~f0\"" /f >nul
if %ERRORLEVEL% EQU 0 (
    color %COLOR_SUCCESS%
    echo Optimization successfully added to startup.
) else (
    color %COLOR_ERROR%
    echo Failed to add optimization to startup.
)
color 07
timeout /t 3 /nobreak >nul
goto menu

REM Function to display script information
:what_is_script
cls
echo What is this script?
color %COLOR_MENU%
echo.
echo This script gathers all optimizations and executes them in one script to improve your system's performance.
echo.
color 07
timeout /t 3 /nobreak >nul
goto menu