Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of Netsh.exe tool and Command Line switch

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly shows you the "sample analysis of Netsh.exe tools and command line switches", which is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and study the "sample analysis of Netsh.exe tools and command line switches".

Using the Netsh.exe tool, you can direct the entered contextual command to the appropriate helper, which then executes the command. A helper is a dynamic link library (.dll) file that extends the functionality of Netsh.exe tools by providing configuration, monitoring, and support for one or more services, utilities, or protocols. Helpers can also be used to extend the functionality of other helpers.

You can use the Netsh.exe tool to perform the following tasks:

Configure the interface.

Configure the routing protocol.

Configure the filter.

Configure routing.

Configure the remote access behavior of the Windows-based remote access router, which runs the routing and remote access server (RRAS) service.

Displays the configuration of the currently running router on any computer.

Use the scripting feature to run a set of commands for the designated router in batch mode.

The syntax for the Netsh.exe tool is:

Netsh [- r router name] [- an AliasFile] [- c Context] [Command |-f ScriptFile]

To display a list of subcontexts and commands that can be used in the context, type the context name at the netsh > command prompt, followed by spaces and?. For example, to display a list of subcontexts and commands that can be used in the / routing context, type routing? at the netsh > command prompt, and then press Enter.

Context

The context string is appended to the Netsh.exe tool command and passed to the relevant helper. Helpers can have one or more entry points that map to context. Some of the contexts available in the Netsh.exe tool are:

Contextual command: / dhcp

Result: change to dynamic Host configuration Protocol (DHCP) context.

Contextual command: / ras

Result: change to the remote access server (RAS) context.

Contextual command: / routing

Result: change to routing context.

Contextual command: / wins

Result: change to the Windows Internet naming Service (WINS) context.

Contexts can also be nested in other contexts. For example, the following context runs in the context of netsh > ras:

Contextual command: / ip

Result: change to Internet Protocol (IP) context.

Contextual command: / ipx

Result: change to the Internet packet Exchange (IPX) context.

Contextual command: / netbeui

Result: changed to NetBios enhanced user interface (NETBEUI) context.

The following subcontext runs in the context of netsh > routing ip:

Contextual command: / autodhcp

Result: change to the autodhcp subcontext.

Contextual command: / dnsproxy

Result: change to the dnsproxy subcontext.

Contextual command: / igmp

Result: change to the Internet Group membership Protocol (IGMP) subcontext.

Contextual command: / mib

Result: change to the management information base (MIB) subcontext.

Contextual command: / nat

Result: change to the Network address Translation (NAT) subcontext.

Contextual command: / ospf

Result: change to the open shortest path first (OSPF) subcontext.

Contextual command: / relay

Result: change to relay child context.

Contextual command: / rip

Result: change to routing Information Protocol (RIP) subcontext.

Netsh.exe command

The following additional commands can be used with the Netsh.exe tool:

Note: optional parameters are enclosed in square brackets ([]). Alternatives are separated by vertical bar (|) characters.

Context command: /?

Result: displays help.

Contextual command: / abort

Result: any changes made in offline mode are discarded. Does not work in online mode.

Contextual command: / add helper DLL-name

Result: install the helper .dll file in netsh.exe.

Contextual command: / alias [alias-name] [string1] [string2...]

Result: if / alias, all aliases are listed. If / alias alias-name, the equivalent string is displayed. If / alias alias-name string1 string2..., sets the alias to the specified string.

Contextual command: / bye

Result: exit the program.

Contextual command: / commit

Result: any changes made in offline mode are committed to the router. Does not work in online mode.

Contextual command: / delete helper .dll file name

Result: delete the helper .dll file in Netsh.exe.

Contextual command: / dump-file name

Result: dump or append the configuration to a text file.

Contextual command: / exec script file name

Result: load the script file and execute the commands in it.

Contextual command: / exit

Result: exit the program.

Context command: / h

Result: displays help.

Contextual command: / help

Result: displays help.

Contextual command: / offline

Result: the current mode is set to offline. Save any changes made in this mode, but you need to set the "commit" or "online" command on the router.

Contextual command: / online

Result: sets the current mode to online. Any changes made in this mode are immediately reflected in the router.

Contextual command: / popd

Result: fetches the context from the stack.

Contextual command: / pushd

Result: the current context is pushed onto the stack.

Contextual command: / quit

Result: exit the program.

Context command: / set mode [mode =] online | offline

Result: sets the current mode to online or offline.

Context command: / show alias | helper | mode

Result: if / show alias, all defined aliases are listed. If / show helper, all top-level helpers are listed. If / show mode, the current mode is displayed.

Contextual command: / unalias alias name

Result: deletes the specified alias.

Available helper dynamic link library files

Routing & remote access IP configuration-Ipmontr.dll

Routing & remote access IPX configuration-Ipxmontr.dll

Interface-Ifmon.dll

RAS-Rasmontr.dll

DHCP-Dhcpmon.dll

WINS-Winsmon.dll

Go back to the top

Helper dynamic link library file related registry key

HKEY_LOCAL_MACHINE/Software/Microsoft/NetSh/

REG_SZ:Ipmontr.dll

REG_SZ:Ipxmontr.dll

REG_SZ:Ifmon.dll

REG_SZ:Rasmontr.dll

REG_SZ:Dhcpmon.dll

REG_SZ:Winsmon.dll

Note: if you try to use Netsh dump-to dump the configuration to a file that is not running, try the following syntax on the command line: netsh dump > filename or path\ filename.

The above is all the contents of the article "sample Analysis of Netsh.exe tools and Command Line switches". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report