MS-DOS Commands :: netsh

Overview:

DANGER: This command is for advanced users only!

Network services shell. Allows you to display or change settings of your computer. The netsh command has an interactive mode (the "shell") as well as an non-interactive mode.

Command Variations:

netsh

Runs netsh in interactive mode. A "netsh>" command prompt appears that indicates that you are now in the netsh shell. You can now type a sequence of commands interactively to netsh.

Tip: To exit, type exit or end

Tip: For help, type help or ?

netsh command

Tells netsh to run the specified command and then exit back to the MS-DOS command prompt.

For example, netsh diag show ip causes netsh to display the IP addresses of all the network adapters. Note: If you are using a router, this command displays your local IP address, it does not display the IP address that the outside world sees; see: getip

netsh command ?

Tells netsh to display help for the specified command and then exit back to the MS-DOS command prompt.

For example, netsh diag show ip ? causes netsh to display help on how to use the diag show ip command.

netsh Contexts:

Because there is so much information that you can display and so many settings that you can change, the information and settings are organized into what are called "contexts". Think of them as directories and sub-directories. For example, everything related to diagnostics is in the diag context.

If you are using netsh non-interactively, include diag as part of the MS-DOS command line, for example: netsh diag show ip

If you are using netsh interactively, at the netsh> prompt, type diag to enter that context (think of it as going into a directory named diag). The prompt will change to reflect the current context (e.g. "netsh diag>"). To back out of a context, type .. (think of it as the equivalent of cd .. with directories).

To get a list of the contexts that you can enter from the current context, type help

Useful netsh Commands:

netsh diag show ip

Displays the IP addresses of all the network adapters.

Note: If you are using a router to connect to the internet, this command displays your local IP address. It does not display the IP address that the outside world sees. Instead, use getip or visit WhatIsMyIP.com or checkip.dyndns.org.

netsh winsock show catalog
netsh winsock show catalog > filename

Displays the list of Winsock LSP's (Layered Service Provider) that are installed on your computer. This information is useful if you are troubleshooting network connectivity caused by a malformed LSP (or malware).

Tip: Use Spybot Search & Destroy to identify and repair some LSP problems.

Since the output can be many pages long, it is advisable to save the output to a file by adding > filename at the end of the command (e.g.: > c:\catalog.txt)

netsh winsock reset catalog

DANGER: This command is for very advanced users only!

Tip: Use Spybot Search & Destroy to identify and repair some LSP problems.

Tip: Create a Windows Restore Point before using this command. Also, going back to an earlier Restore Point may fix the problem you're experiencing. For help with Restore Points, see: XP, Vista, Windows 7.

Removes all third-party LSP's (Layered Service Provider) and resets the Winsock catalog to the factory default settings. This can be useful if a malformed LSP (or malware) is installed that results in loss of network connectivity.

While use of this command can restore network connectivity, it should be used with extreme care and used only as a last resort. Existing programs that uses their own LSP's (e.g.: Google Desktop Search) will stop working and will need to be reinstalled.

See also: How to reset Internet Protocol (TCP/IP) (KB299357)

netsh /?

Usage: netsh [-a AliasFile] [-c Context] [-r RemoteMachine] 
             [Command | -f ScriptFile]

The following commands are available:

Commands in this context:
?              - Displays a list of commands.
add            - Adds a configuration entry to a list of entries.
bridge         - Changes to the `netsh bridge' context.
delete         - Deletes a configuration entry from a list of entries.
diag           - Changes to the `netsh diag' context.
dump           - Displays a configuration script.
exec           - Runs a script file.
firewall       - Changes to the `netsh firewall' context.
help           - Displays a list of commands.
interface      - Changes to the `netsh interface' context.
lan            - Changes to the `netsh lan' context.
ras            - Changes to the `netsh ras' context.
routing        - Changes to the `netsh routing' context.
set            - Updates configuration settings.
show           - Displays information.
winsock        - Changes to the `netsh winsock' context.

The following sub-contexts are available:
 bridge diag firewall interface lan ras routing winsock

To view help for a command, type the command, followed by a space, and then
 type ?.

(Enlarge: netsh /?)

Related Commands: