net use /delete – Delete Windows Shares

The “net use” command is used to mount or map Windows networks shares. After mounting them we may need to delete or remove these shares too. The “net use /delete” or “net use /del” command is used to remove or delete mapped Windows network shares. In this tutorial, we will learn how to delete all ready mounted or mapped Windows network shares.

net use /delete Command Syntax

The “net use /delete” command has the following syntax.

net use /delete SHARE
  • SHARE is the local drive letter which is already mounted.

List Currently Mapped Windows Shares

Before starting to delete mapped Windows shares listing them is very useful and important. Because we wan get some information like drive letter, current status, remote windows share an address, etc. The drive letter is used to delete a specific share. The “net use” command lists all network shares and provides basic information about them.

net use

The output is like below.

Status                Local     Remote                                  Network 
Disconnected     Z:          \192.168.146.129\Backups       Microsoft Windows Network

We can also get detailed information about the specific network share by specifying the share with the local drive letter. In the following example we will print information about the Z: drive which is a windows network share.

net use Z:

The output is like below.

Local name        Z:
Remote name       \192.168.146.129\Backups
Resource type     Disk
Status            Disconnected
Opens           0
Connections     1
The command completed successfully.

Delete Windows Share

We will delete or remove a mapped Windows share via the “net use /delete” command. First, we will open the command line interface where MS-DOS or PowerShell is OK. Then we will provide the local drive letter of the share which is Z: in this case. Keep in mind that this will delete the share event it is not actively mapped.

net use /delete Z:

When the windows shared is deleted properly the following success message is printed to the command line.

Z: was deleted successfully.

Alternatively the “/delete” can be shortened into the “/del” which work without problem like below.

net use /delete Z:

After these, we can list and check the available Windows network shares where we will see that Z: is deleted with the “net use” command. The share list is empty we will see the following output.

New connections will be remembered.
There are no entries in the list.

Delete All Windows Share

In some cases, it is not easy deleting all shares one by one. The glob * can be used to specify all windows shares and delete them with a single command.

net use /delete *
See also  PowerShell Start-Process Command - Run Executables

Leave a Comment