Microsoft DOS netsh command

Quick links

About netsh
Availability
Syntax
Examples

About netsh

MS-DOS command that enables users to change network settings such as changing their network device from a dynamic address to a static address or changing the IP address.

Availability

The netsh.exe command is an external command accessed through C:\Winnt\System32 directory and is available in the below Microsoft operating systems.

Windows 2000
Windows XP
Windows Vista
Windows 7

Syntax

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

?Displays a list of commands.
addAdds a configuration entry to a list of entries.

add helperInstalls a helper DLL.
deleteDeletes a configuration entry from a list of entries.

delete helperDeletes a helper DLL.
dumpDisplays a configuration script.
execRuns a script file.
helpDisplays a list of commands.
interfaceChanges to the `interface' context.

ipChanges the 'interface ip' context.
rasChanges to the `ras' context.

aaaaChanges to the `ras aaaa' context.
appletalkChanges to the `ras appletalk' context.
ipChanges the 'ras ip' context.
ipxChanges to the `ras ipx' context.
netbeuiChanges to the `ras netbeui' context.
routingChanges to the `routing' context.

ipChange to the 'routing ip' context.
ipxChanges to the `routing ipx' context.
setUpdates configuration settings.

machineSets the current machine on which to operate.
showDisplays information.

show aliasLists all defined aliases.
show helperLists all the top-level helpers.

Available commands after you have entered the netsh command (typing netsh at the prompt and pressing enter).

..Goes up one context level.
?Displays a list of commands.
abortDiscards changes made while in offline mode.
addAdds a configuration entry to a list of entries.
aliasAdds an alias.
byeExits the program.
commitCommits changes made while in offline mode.
deleteDeletes a configuration entry from a list of entries.
dumpDisplays a configuration script.
execRuns a script file.
exitExits the program.
helpDisplays a list of commands.
interfaceChanges to the `interface' context.
offlineSets the current mode to offline.
onlineSets the current mode to online.
popdPops a context from the stack.
pushdPushes current context on stack.
quitExits the program.
rasChanges to the `ras' context.
routingChanges to the `routing' context.
setUpdates configuration settings.
showDisplays information.
unaliasDeletes an alias.

Examples

netsh

Enter the netsh command.

netsh dump

Dump all the network information as a script to the screen. Can also be sent to a file by doing netsh dump > file.txt . This script can then be executed using the exec command.

set address name="Local Area Connection" source=dhcp

Set the "Local Area Connection" to DHCP.

set address local static 10.0.0.9 255.0.0.0 10.0.0.1 1

Set the local address to Static.

netsh interface ip show config

View network ip configuration. Below is an example of what may be seen.

Configuration for interface "Local Area Connection"
DHCP enabled: Yes
InterfaceMetric: 1
DNS servers configured through DHCP
WINS servers configured through DHCP