Netsh

zhaozj2021-02-16  141

Repost

Have you thought that everyone has thought about changing IP and gateways in the command line. It used to be too troublesome under NT4, and now the netsh command under Windows 2000 can implement this feature.

Netsh is the command line and script utility of the Windows 2000 network component of the local or remote computer. To archive or configure other servers, the NetSH utility can also save the configuration script in a text file.

The NetSH utility is a housing that supports multiple Windows 2000 components by additional "Netsh Help DLL". "Netsh Help DLL" provides additional commands for monitoring or configuring a specific Windows 2000 network component, thereby extending Netsh's features. Each "Netsh Help DLL" provides an environment and a set of commands for specific network components. There may be sub-environments in each environment. For example, there is a sub-environment IP and IPX in the routing environment, which sets the IP route and IPX routing commands.

Netsh command line options include the following:

Usage: Netsh [-a aliasfile] [-c context] [-r RemoteMachine] [command | -f scriptfile]

The following instructions are valid:

The command in this context:? - Displays a list of commands. AAAA - Change to `aaaa 'context. Add - Add a configuration item to the project list. Delete - Delete a configuration item on the project list. DHCP - Change to `DHCP 'context. Dump 0 - Displays a configuration script. Exec - Run a script file. Help - Displays the list of commands. Interface - Change to `Interface 'context. RAS - Change to `Ras' context. Routing - Change to `Routing 'context. SET - Update Configuration Settings. Show - Display Information WINS - Change to `Wins' context.

The following sub-context available: Routing Interface Ras DHCP Wins Aaaa

If you need more help information for the command, type the command, followed by? -a aliasfile specifies a separate name file. The alias file contains a Netsh command list and an alien version, so you can replace the netsh command using the alias command line. You can use an alias file to map more familiar commands in other platforms to the appropriate Netsh command.

-c context specifies the command environment corresponding to the installed support DLL.

Command Specifies the Netsh command to be executed.

-f scriptfile Specifies all Netsh commands in the ScriptFile file.

-r RemoteMachine Specifies to run the netsh command on a remote computer, specify a remote computer by name or IP address.

You can abbreviate the shortest string of the command abbreviation. For example, the release of the SH IP int command is equivalent to publishing show ip interface. The Netsh command can be a global or specific environment. Global commands can be released in any environment and used for general NetSH utilities. Commands of a particular environment vary depending on the environment. You can record the published command in the log file to create a review discrimination of the Netsh command session.

List the Netsh global command.

Command Description .. Move an environment level. Or Help Displays the command line Help. Show version displays the current version of Windows and Netsh utilities. Show netdlls displays the current version of the installed "Netsh Help DLL". Add helper adds "Netsh Help DLL". Delete Helper deletes "Netsh Help DLL". Show Helper displays the installed "Netsh Help DLL". CMD creates a Windows 2000 command window. Online Sets the current mode to an online. OFFLINE sets the current mode to offline. Set Mode Sets the current mode to an online or offline. Show Mode displays the current mode. FLUSH discards any changes made in offline mode. Commit Submit changes in offline mode. Set audit-logging Turns a recording tool on or off. Show audit-logging Displays the current audit record settings. Set loglevel sets the level show loglevel displaying the log information. Set Machine Configure a computer that executes the netsh command. Show machine shows the computer that executes the netsh command. EXEC executes a script file that includes Netsh commands. Quit or BYE or EXIT exits the Netsh utility. Add Alias ​​adds an alias to an existing command. Delete Alias ​​deletes an alias for existing commands. Show alias displays all defined alias. DUMP writes the configured text file. POPD pops up the environment of the environment from the stack. Pushd puts the current environment into the stack of script commands. The Netsh utility has the following command mode:

Inline online mode, the command released at the Netsh command prompt is executed immediately.

In the offline offline mode, the released command will be accumulated at the Netsh command prompt, and will be executed in batches by issuing the commission global command. The accumulated command can be discarded by publishing the Flush global command.

The script uses the -f command line option, or publishes the EXEC global command at the Netsh command prompt, you can perform all the netsh commands in the specified file.

To create a current configured script, use the DUMP global command. The dump command outputs the currently running configuration according to the Netsh command. You can use the script created by this command to configure a new server or reconfigure an existing server. If you want to make a big change to the configuration of the component, it is recommended that you start configuring the session with the dump command to prevent the configuration before making changes.

Interface Command The following table lists the Netsh commands that can be typed at the Windows 2000 command prompt, which are used to manage interface settings on your computer running Windows 2000 Server and Route and Remote Access service. If there is multiple commands for a particular feature, use the slash (/) between each command.

When you type a command at the command prompt, add Netsh before each command. To get a precise syntax for each command, you can type it after the command? Options For example, to obtain the command line "Help" for the Netsh interface command, type Netsh Interface in the command prompt?

Command Description Interface SET / Show Interface Enable, Disable, Connect, Disconnect, and Display Request Dial Interfaces. Interface SET / Show Credentials Configure or displays username, password, and domain name on request dial interface.

......... (omitted two, 3,000 words)

The collateration is correct, and now look at the configuration of network settings under Win2000.

D: /> netshnetsh> interfaceInterface> dump # ======================== # interface configuration # =========== ============ Pushd InterfaceReset All

POPD # interface configuration end

# ---------------------------------- # interface ip configuration # ---------- ------------------------ Pushd Interface IP

# "Local connection 2" interface IP configuration

SET Address Name = "Local Connection 2" Source = DHCPSET DNS Name = "Local Connection 2" Source = DHCPSET WINS Name = "Local Connection 2" Source = DHCP

# "Local Connection" interface IP configuration

set address name = "Local Area Connection" source = static addr = 192.168.1.10 mask = 255.255.255.0set address name = "Local Area Connection" gateway = 192.168.0.1 gwmetric = 1set dns name = "Local Area Connection" source = static addr = 192.168 .0.1set wins name = "Local connection" Source = static addr = none

POPD # interface IP configuration ends

If you want to quickly modify a local IP address. You can write the following content with text:

Interface Ipset Address locally connected static 192.168.5.10 255.255.255.0 192.168.0.1 1 ^^ ^^^ ^^^ ^^^ ^^ interface name IP address subnet mask gateway interface

Saved as Local.sh as above

D: /> Netsh Exec local.sh

I.e. Is it very simple? There are still a lot of strong features of the Netsh command, and have not been played. If you have confidence, try it yourself!

Test environment: Windows 2000 Server Chinese version (no SP1 installed

转载请注明原文地址:https://www.9cbs.com/read-8920.html

New Post(0)