Minimize
Netsh Commands for All Contexts
Updated: February 8, 2008
Applies To: Windows Server 2008
Netsh uses the following standard commands in all contexts that you can run from a Netsh.exe command prompt (that is, netsh>).
Netsh standard commands
Following is the list of netsh commands that you can run in all netsh contexts. To view the command syntax, click a command:
..
Moves to the context that is one level up.
Syntax
..
Parameters
/?
abort
Discards any changes made in offline mode. Abort has no effect in online mode.
Syntax
abort
Parameters
/?
add helper
Installs the helper dynamic-link library (DLL) in netsh.
Syntax
add helper DLLName
Parameters
DLLName
/?
alias
Adds an alias that consists of a user-defined character string, which netsh treats as equivalent to another character string. Used without parameters, alias displays all available aliases.
Syntax
alias[AliasName] [String1 [String2 ...]]
Parameters
alias[ AliasName]
alias[ AliasName][ String1[ String2...]]
AliasName
/?
Examples
The following netsh sample script sets two netsh aliases, Shaddr and Shp, and then leaves the Netsh command prompt in the Interface IP context:
alias shaddr show interface ip addr alias shp show helpers interface ip
If you type shaddr at the Netsh command prompt, Netsh.exe interprets this as the command show interface ip addr. If you type shp at the Netsh command prompt, Netsh.exe interprets this as the command show helpers.
bye
Exits Netsh.exe.
Syntax
bye
Parameters
/?
commit
Commits any changes made in the offline mode to the router. Commit has no effect in online mode.
Syntax
commit
Parameters
/?
delete helper
Removes the helper DLL from netsh.
Syntax
delete helper DLLName
Parameters
DLLName
/?
dump
Creates a script that contains the current configuration. If you save this script to a file, you can use the file to restore configuration settings that have been changed. Used without parameters, dump displays all of the netsh context configurations.
Syntax
dump [FileName]
Parameters
[ FileName]
/?
exec
Loads a script file and runs commands from it.
Syntax
exec ScriptFile
Parameters
ScriptFile
Remarks
The ScriptFile can run on one or more computers.

exit
Exits Netsh.exe.
Syntax
exit
Parameters
/?
help
Displays help.
Syntax
{/? | ? | help | h}
Parameters
none
offline
Sets the current mode to offline.
Syntax
offline
Parameters
/?
Remarks
Changes that you make in this mode are saved, but you must run the commit or online command to set the changes in the router.

When you switch from offline mode to online mode, changes that you made in offline mode are reflected in the configuration that is currently running.

Changes that you make in online mode are immediately reflected in the configuration that is currently running.

online
Sets the current mode to online.
Syntax
online
Parameters
/?
Remarks
Changes that you make in online mode are immediately reflected in the configuration that is currently running.

When you switch from offline mode to online mode, changes that you made in offline mode are reflected in the configuration that is currently running.

popd
Restores a context from the stack.
Syntax
popd
Parameters
/?
Remarks
Used in conjunction with pushd, popd enables you to change the context, run the command in the new context, and then resume the prior context.

Examples
The following sample script changes a context from the root context to the interface ip context, adds a static IP route, and then returns to the root context:
netsh> pushd
netsh> interface ip
netsh interface ip> set address local static 10.0.0.9 255.0.0.0 10.0.0.1 1
netsh interface ip> popd
netsh>
pushd
Saves the current context on a first-in-last-out (FILO) stack.
Syntax
pushd
Parameters
/?
Remarks
Used in conjunction with popd, pushd enables you to change the context, run the command in the new context, and then resume the prior context.

quit
Exits Netsh.exe.
Syntax
quit
Parameters
/?
set file
Copies the command prompt window output to a file.
Syntax
set file [ mode= ]{openFileName | appendFileName | close}
Parameters
openFileName
appendFileName
close
/?
Remarks
If the specified FileName does not currently exist, netsh creates a new file with that name. If the specified FileName does currently exist, netsh overwrites the existing data.

Examples
To create a new log file called Session.log and copy all succeeding netsh input and output to Session.log, type:
set file open c:\session.log
set machine
Specifies the computer on which to perform configuration tasks. Used without parameters, the local computer is configured.
Syntax
set machine [ name= ]ComputerName [ user= ][[ DomainName\]UserName ] [ pwd= ][Password | *]
Parameters
ComputerName
DomainName
UserName
Password
/?
Remarks
You can run commands on multiple computers from a single script by using set machine more than once in the script. For example, you can use set machine in a script to specify a destination computer (Computer A), and then any additional commands you add to the script will run on Computer A. You can then use set machine again in the same script to specify another destination computer (Computer B), and then any additional commands you add to the script will run on Computer B.

set mode
Sets the netsh mode to online or offline. Either offline or online must be specified.
Syntax
set mode [ mode= ] {online | offline}
Parameters
online
offline
commit
/?
show
Displays alias, helper, and mode information.
Syntax
show {alias | helper | mode}
Parameters
alias
helper
mode
/?
unalias
Deletes the specified alias.
Syntax
unalias AliasName
Parameters
AliasName
/?
Show:
Master Technician Technology Services