netsh Command – Complete Reference (Windows)netsh (Network Shell) is a powerful command-line utility used to configure, monitor, and troubleshoot various networking settings on Windows systems.
netsh [context] [subcontext] [command]
| Context | Description |
|---|---|
interface |
Manage network interfaces (IP, DNS, etc.) |
firewall |
Legacy firewall management (deprecated) |
advfirewall |
Advanced Windows Firewall configuration |
wlan |
Wireless settings and profiles |
winhttp |
WinHTTP proxy configuration |
branchcache |
Manage BranchCache settings |
dhcpclient |
Manage DHCP client |
netsh interface ip show config
netsh interface ip set address name="Ethernet" static 192.168.1.10 255.255.255.0 192.168.1.1
netsh interface ip set address name="Wi-Fi" source=dhcp
netsh interface ip set dns name="Ethernet" static 8.8.8.8
netsh interface ip add dns name="Ethernet" 1.1.1.1 index=2
netsh int ip reset
netsh winsock reset
netsh wlan show profiles
netsh wlan show profile name="MyWiFi" key=clear
netsh wlan export profile folder="C:\backup" key=clear
netsh advfirewall firewall show rule name=all
netsh advfirewall firewall add rule name="OpenPort80" dir=in action=allow protocol=TCP localport=80
netsh advfirewall set allprofiles state off
| Task | Command Example |
|---|---|
| View IP config | netsh interface ip show config |
| Set static IP | netsh interface ip set address ... static ... |
| Use DHCP | netsh interface ip set address ... dhcp |
| Set/Change DNS | netsh interface ip set dns ... |
| Reset TCP/IP | netsh int ip reset |
| Reset Winsock | netsh winsock reset |
| Show Wi-Fi passwords | netsh wlan show profile name="SSID" key=clear |
| Export Wi-Fi profiles | netsh wlan export profile folder="..." key=clear |
| Add firewall rule | netsh advfirewall firewall add rule ... |
| Disable firewall | netsh advfirewall set allprofiles state off |
netsh commands.netsh functions are deprecated in newer Windows versions."Interface Name") if names have spaces.The netsh command is an advanced network configuration and troubleshooting tool in Windows. It's essential for scripting, diagnostics, and administrative tasks involving IP, DNS, firewall, and wireless settings.