Skip to content

Instantly share code, notes, and snippets.

@tracywhodoesnot
Created October 6, 2023 13:15
Show Gist options
  • Select an option

  • Save tracywhodoesnot/4c4af41d0a56c44d251e75306028af17 to your computer and use it in GitHub Desktop.

Select an option

Save tracywhodoesnot/4c4af41d0a56c44d251e75306028af17 to your computer and use it in GitHub Desktop.
Windows 11 network optimization batch file
@echo off
setlocal EnableDelayedExpansion
REM Check if running as administrator
net session >nul 2>&1
if %errorLevel% == 0 (
echo Running as administrator...
) else (
echo This batch file must be run as administrator!
pause
exit /b
)
REM Set variables for TCP/IP service provider priority
set regkey=HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\ServiceProvider
set LocalPriority=4
set HostPriority=5
set DnsPriority=6
set NetbtPriority=7
REM Disable Nagle's algorithm
set regkey=HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
reg add %regkey% /v TcpAckFrequency /t REG_DWORD /d 1 /f
reg add %regkey% /v TCPNoDelay /t REG_DWORD /d 1 /f
REM Increase maximum simultaneous connections
reg add %regkey% /v MaxUserPort /t REG_DWORD /d 65534 /f
reg add %regkey% /v TcpTimedWaitDelay /t REG_DWORD /d 30 /f
netsh int ipv4 set dynamicport tcp start=1025 num=64510
REM Enable network optimizations
netsh interface tcp set global chimney=disabled
netsh interface tcp set global autotuninglevel=experimental
netsh interface tcp set global rss=enabled
netsh interface tcp set global ecncapability=disabled
netsh int tcp set supplemental Internet congestionprovider=ctcp
netsh int tcp set global dca=enabled
netsh int tcp set global rsc=disabled
netsh int tcp set global timestamps=disabled
netsh int tcp set global initialRto=3000
netsh int tcp set global nonsackrttresiliency=disabled
netsh int tsp set global maxsynretransmissions=2
netsh int ipv4 set subinterface "Wi-Fi" mtu=1500 store=persistent
REM Reset Winsock Catalog and TCP/IP
netsh winsock reset
netsh int ip reset reset.log
REM Flush DNS cache
ipconfig /flushdns
REM release/renew IP address
ipconfig /release
ipconfig /renew
REM Log changes to a file
echo %date% %time% - Network optimizations applied >> network_optimizations.log
REM Wait for user input before closing window
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment