net - Manage Users, Services, and Shares

Maintained on
Table of Contents

The net command lets you manage user accounts, groups, services, shared folders, and network connections in Windows from one place. You add a subcommand after net to choose what to do.

It has been around for a long time and often appears in batch files for environment setup and common tasks such as restarting a service.

Basic syntax of net

net <subcommand> [arguments]
SubcommandPurpose
net userShow, add, change, and delete user accounts
net localgroupShow local groups and add or remove members
net startList running services and start a service
net stopStop a service
net shareShow, create, and remove shared folders
net useMap and disconnect network drives
net helpmsgShow the meaning of an error number
Many operations require administrator rights

Adding users, stopping services, and similar operations fail unless Command Prompt is running as administrator. If you see “System error 5 has occurred. Access is denied.”, run Command Prompt as administrator and try again.

Work with user accounts (net user)

Show the user list and details

net user

This lists the local users on this computer. Specify a user name to see details such as whether the account is active, the last logon, and group membership.

net user taro

Add and delete users

net user taro * /add
net user taro /delete

With *, you enter the password interactively. The characters you type are not displayed.

Do not write the password in the command

You can write something like net user taro password /add, but then the password remains on screen and in the batch file as plain text. Use * when running it by hand.

Disable and enable a user

You can make an account unable to sign in without deleting it.

net user taro /active:no
net user taro /active:yes
Add /domain for domain users

By default, net user targets local accounts on this computer. To work with accounts in a domain environment, add /domain.

Work with groups (net localgroup)

net localgroup
net localgroup Administrators

The first line lists the local groups, and the second lists the members of the Administrators group. Use /add and /delete to add or remove users.

Add_taro_to_the_Administrators_group
net localgroup Administrators taro /add
Remove_taro_from_the_Administrators_group
net localgroup Administrators taro /delete
Group names may differ depending on the display language

Group names such as Administrators can have different names depending on the Windows display language. Run net localgroup on your own system and check the actual name before using it.

Start and stop services (net start / net stop)

net start with no arguments lists the services that are currently running.

net start

Specify a service name to start that service. Use net stop to stop it.

Restart_the_Print_Spooler_service
net stop spooler /y
net start spooler
- □ ×
Command Prompt Icon
Command Prompt
Microsoft Windows [Version xx.x.xxxxx.xxx]
(c) 2026 Ribbit App Development All rights reserved.
 
C:\users\user>net stop spooler
The Print Spooler service is stopping.
The Print Spooler service was stopped successfully.
C:\users\user>

You can specify either the service name, such as spooler, or the display name, such as "Print Spooler". If the display name contains spaces, enclose it in double quotation marks.

The difference between net and sc

net start and net stop wait until the service has finished starting or stopping before returning. sc start and sc stop, on the other hand, return as soon as the request is sent. When a batch file needs to stop a service before moving on, net stop is the simpler choice. Use the sc command for detailed service settings and status checks.

Work with shared folders (net share)

net share

This lists the folders shared from this computer. Shares ending in $, such as C$, ADMIN$, and IPC$, are created automatically for administrative purposes.

To share a folder, write the following.

Share_C_Data_under_the_name_Data
net share Data=C:\Data /grant:everyone,read

With /grant:user,permission, you specify the user to allow and the permission (read, change, or full). To remove a share, add /delete.

net share Data /delete
Removing a share does not delete the folder

/delete removes only the share setting. The original folder and files remain.

Work with network drives (net use)

net use

This shows the current connections. To disconnect all of them, do the following.

net use * /delete /y

Mapping network drives and keeping the connection after a restart are covered in detail in the related article.

Look up the meaning of an error number (net helpmsg)

When a net command returns a numbered error such as “System error 5 has occurred.”, you can check its meaning with net helpmsg.

net helpmsg 5
- □ ×
Command Prompt Icon
Command Prompt
Microsoft Windows [Version xx.x.xxxxx.xxx]
(c) 2026 Ribbit App Development All rights reserved.
 
C:\users\user>net helpmsg 5
Access is denied.
C:\users\user>
おすすめ書籍※ 広告を含む場合があります
中小企業経営者のためのRPA入門 RPA導入を成功させる方法

中小企業経営者のためのRPA入門 RPA導入を成功させる方法

60分でわかる! AIエージェント 超入門

60分でわかる! AIエージェント 超入門

コマンドラインの黒い画面が怖いんです。

コマンドラインの黒い画面が怖いんです。

知識・才能ゼロでもらく~に月10万円稼ぐ! よくわかるAI副業超入門

知識・才能ゼロでもらく~に月10万円稼ぐ! よくわかるAI副業超入門

Batch file example

This example restarts a service and shows a message if it fails.

restart-spooler.cmd
@echo off

net stop spooler /y
net start spooler
if errorlevel 1 (
  echo Failed to start the service. Check that you are running as administrator.
  exit /b 1
)

echo Restarted.

A net command returns exit code 0 on success and a nonzero value on failure, so you can detect failure with if errorlevel 1.

PowerShell equivalents

The net command remains for backward compatibility, and in new scripts you can also use PowerShell cmdlets.

Goalnet commandPowerShell
List usersnet userGet-LocalUser
Add a usernet user username * /addNew-LocalUser
Disable a usernet user username /active:noDisable-LocalUser
Add a member to a groupnet localgroup group user /addAdd-LocalGroupMember
Start a servicenet start serviceStart-Service
Stop a servicenet stop serviceStop-Service
List shared foldersnet shareGet-SmbShare

See the related article for how to call PowerShell from Command Prompt.

Summary

GoalCommand
List usersnet user
Add a usernet user username * /add
Disable a usernet user username /active:no
Add to the Administrators groupnet localgroup Administrators username /add
Stop or start a servicenet stop / net start
Share a foldernet share name=path /grant:...
Look up an error numbernet helpmsg number

Practice questions

Practice Problem

Which command stops a service?

Choose one answer.

  1. net user spooler
  2. net stop spooler
  3. net share spooler

Practice Problem

Which form adds a user without leaving the password on screen or in a batch file?

Choose one answer.

  1. net user taro * /add
  2. net user taro password123 /add
  3. net user taro /active:no
#Command Prompt #Batch Files #Command Line #Commands #User #Services #Shared Folders