What is the Net Use command?

The "Net Use" command is a command-line utility introduced in Windows 2000 and is available in all subsequent versions of the Windows operating system. It is used for managing network connections. This command can be employed to map network drives, connect to shared folders, disconnect from shared resources, and more.

It is very helpful for automating various network-related tasks, such as connecting or disconnecting from shared resources, displaying information, and setting options for a specific user.

In this article, we will take a closer look at the Net Use command and how to map a network drive.

Mapping a drive with the net use command

 Net Use Command Syntax and Options

The syntax of the "Net Use" command refers to the order of parameters required when executing a specific task. On the other hand, options are used to modify the behavior of the command.

Network Usage Command Syntax:

Here's the syntax for the Net Use command:

NET USE {device name | *} [\computer name\share name[\volume] [{password | * }] ] [/USER:[domain\]user name] [/USER:[dot-separated domain\]user name] [/USER:[user name@dot-separated domain] ] [/HOME {device name | *} [{password | * }] ] [/PERSISTENT:{YES | NO} ] [/SMARTCARD] [/SAVECRED] [/DELETE] [/HELP] [/?]

Network usage command options:

The options you can use with the Net Use command are:

  • devicename: Specifies the name to assign to the local resource, such as * for all devices.
    • \\Computer_name\Share_name: This is the network path of the shared resource.
    • volume: An optional parameter that specifies the volume label of the storage volume for the shared resource.
    • password: Specifies the password used to connect to the shared resource.
  • /user: specifies the username to be used for logging in. If omitted, it is assumed to be the currently logged-in user.
  • domainname: The domain for the user account to log in with.
  • username: Use this username to log in.
  • /home : Uses the home directory of the user specified by UserName, or the home directory of the current logged-in user.

    /persistent:{yes|no}: Specifies whether the redirect is persistent.

    Authenticate using a smart card.
  • /savecred: Specifies that Winlogon should save the credentials used for this connection and reuse them when accessing this resource.
    /delete: Specifies that local security authority (LSA) settings, such as passwords and user names, be deleted when the connection is removed.
  • /help: Specifies whether to display help information for this command.
    • /?: Same as /help.

How to Use the Net Use Command in Windows?

Here are the steps to follow when using the Net Use command in Windows:

Step 1: Open the Command Prompt and type net use.

Using the net use command in Windows

If Net Use is issued with no parameters, it displays the current connections.

Net use command line

Step 3: To view the available options for the "Net Use" command, type in net use /? or net use /help, then press Enter. You can also use the /? option to learn more about a specific connection. For example, to learn about the "Persistent" option, type in net use /? Persistent, then hit Enter.

How to Use Net Use to Map a Network Drive

Mapping a network drive is the process of connecting to a shared network folder through Microsoft Windows so that you can access it like a local drive. Here, you'll learn how to use the Net Use command to map a network drive.

Before you begin, there are a few things you should know:

    The name of the computer you want to connect to
    • The name of the shared folder on that computer
    • If the shared folder requires permissions or credentials different from what you normally use to log in

The steps to map a network drive are as follows: 1. Open "My Computer" or "File Explorer" (on Windows, you can press the Win+E shortcut keys). 2. In the left navigation pane, locate and click on "Network" (Network). 3. Find the network location you want to map. This could be a shared folder or server, typically displayed with the name of another computer or device. 4. Right-click on the network location you wish to map, then select "Map Network Drive." 5. In the "Map Network Drive" window that appears, choose the letter you want to assign to this network location (e.g., if E: is not in use, select E:). 6. In the "Folder" field, enter the full path of the network location, or click the "Browse" button to locate it. 7. If you want the network drive to reconnect automatically each time you log in, check the "Reconnect at sign-in" option. 8. If you need to connect to the network location using different credentials (username and password), check "Connect using different credentials" and input the relevant information. 9. Click the "Finish" button. The system will attempt to connect to the specified network location, and if successful, the new network drive will appear in "My Computer" or "File Explorer." Please note that these steps apply to the Windows operating system. Other systems like Mac or Linux may have different methods for mapping network drives.

Step 1: Search for “Command Prompt,” and then select “Run Command Prompt as administrator.”

Step 2: Type the following command at the command prompt, and then press Enter: net use [Drive:] \\[ComputerName]\[ShareName]. For example, to map the root of the Share shared folder on a computer named ComputerName to drive Z:, type the following command, and then press Enter: net use z: \\computername\share

Map a network drive using net use

Step 3: The system will prompt you to enter the credentials. Type them in and press Enter.

Note: If you want to use credentials different from the ones you're currently logged on with, type the following command: net use [drive:] \\[computer name]\sharename /user:[domain\username] [password]

For example, to map the root of a shared folder named Share to drive Z: using the User1 account in the Contoso domain, type the following command: net use z: \\computername\share /user:contoso\user1 password

Step 4: To verify that the shared folder is mapped to a drive, type the command above in Command Prompt and press Enter: “net use” will display a list of all mapped drives.

Step 5: To disconnect a mapped network drive, type the following command at the Command Prompt, and then press Enter: net use [drive:] /delete

For example, to disconnect the Z: drive, type the following command, and then press ENTER: net use z: /delete

Note: You can also use an asterisk (*) as a wildcard to remove all mapped network drives.

After going through this tutorial, you should be able to use the Net Use command to map a network drive. If you have any suggestions or ideas, feel free to leave a comment below.