System command

netsh command

View and manage network contexts and settings through subcommands.

Availability: Microsoft Learn command reference spanning Windows client and Windows Server releases; some entries are legacy, role-specific, optional-feature or interactive subcommands.中文

Documented syntax

netsh [-a <Aliasfile>] [-c <Context>] [-r <RemoteMachine>] [-u <DomainName>\<Username>] [-p <Password> | *] [<Command> | -f <ScriptFile>]

The linked Microsoft Learn article is the upstream authority. Availability may depend on Windows release, role, optional feature or interactive tool context.

Examples

Example usage for netsh.

netsh interface ip show config

Example from the linked Microsoft Learn article. Check its paths, targets and availability before adapting it.

netsh interface ipv4 show config

Example from the linked Microsoft Learn article. Check its paths, targets and availability before adapting it.

netsh -f C:\Scripts\network.txt

Parameters, options and clauses

Option / clauseDescription
-a <AliasFile>Run an alias script and return to the netsh shell.
-c <Context>Enter a networking context such as interface or wlan.
-r <RemoteMachine>Run the command against a remote computer where supported.
-u <Domain\Username>Specify the account used for a remote command.
-p <Password>|*Provide a password or use * to enter it interactively.
-f <ScriptFile>Run commands from a script file and exit.
-u <DomainName><Username>Microsoft documents this switch; use the linked reference for accepted values, effects and version limits.
<Command>Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
<DomainName>Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
<Username>Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
Safety note

Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.

Official reference ↗Back to directory