One of the most ubiquitous commands in an experienced Windows administrator's arsenal is probably Windows.Internet
domain🇧🇷 This command has many functions. Read this article to learn more about him.net use
.
No reader? Check out this related tutorial video!
Don't you see the video? Make sure your ad blocker is disabled.
onet use
The command is an older but fully functional command for creating, deleting, and managing Windows SMB connections and mapped drives.
let's divenet use
and describes what it is capable of and how to use it in this tutorial.
Index
requirements
To follow the examples in this tutorial, make sure you have at least the following:
- A Windows client computer (any version will work) in an Active Directory domain. This tutorial uses Windows 10.
o
net use
The command works in non-domain environments. Otherwise, you must always pass a username and password to authenticate the remote file share.
- one or moreavailable file shareson a server-accessible part of an Active Directory domain. This tutorial links to aadministrative file sharingI callSwiss francscalled a serverDEVSRV.
- A user account with read access to the file share and NTFS read permissions for the folder the share points to
Begin withnetwork usage
onet use
The command allows you to work with files on network file shares. This is done with various parameters and switches as shown below.

onet use
The command can display device connections, create new connections, and delete them. In this tutorial, you'll learn about each parameter and see what use case each parameter is for.
You will see a lot of the content there
net use
you refer to the endpoints you work with as "connections" instead of "entities". This command can connect to printers and other devices, but for this tutorial we will focus on remote file sharing.(Video) How to Map Network Drive using Command Line
Create remote connections
Creating new connections is one of the most common reasons to use it.net use
Domain. This command allows you to connect to remote file shares to copy files, delete files, etc. as if the folder you are connecting to is local.
To create a new remote file sharing connection, you have two optionsnet use
🇧🇷 You can create what Microsoft calls a "no device" connection, which is simply a file sharing connection with no drive letter or drive assigned.
Map network drives with credentials
Mapping network drives is one of the most common uses ofnet use
Domain. This command allows you to map a network drive from the command line as usualvia file explorer.
Assuming you are on a Windows 10 PC in a domain environment with a Windows server hosting a file share:
1. Open a command prompt or PowerShell console as an administrator.
Related:How to run PowerShell as administrator
2. Let's map the drive letterF:For himDEVSRVShare server filesSwiss francs🇧🇷 To do this, specify the drive letter to map the network drive, followed by theruta UNCfrom the remote file share.
uso neto f: \\DEVSRV\c$
You can use any letter to map the network drive if it is not already in use.
If the shared file contains spaces, always enclose them in quotes, e.g.
\\DEVSRV\"My File Share"
.

3. Run nownet use
there are no parameters to confirm that Windows correctly mapped the drive.

4. Open File Explorer and you will also notice a new network location.

If you don't care which device (drive letter) you want to map the drive to, you can also use an asterisk (*
) for the drive letter. This will tell Windows to look for the next available drive letter.

Map network drives with alternate credentials
If you performed the previous demo and mapped a network drive, you have authenticated as a logged in user. But what if you need to authenticate to the remote file share using alternate credentials?
Mapping an authenticated network drive as a non-logged in user account is almost the same as with a logged in account. The only difference is that a few more parameters are used.
To map a network drive with alternate credentials, open a command prompt or a PowerShell console as an administrator.
pick upnet use
Deployment:
- The drive letter to map
- The UNC path of the file share
- The username for authentication (
/Ella
) - the password
In the following example, Windows maps drive F: to the \\DEVSRV\c$ file share by authenticating astest_userAccount inDomaindomain with passwordpassword here.
net use f: \\DEVSRV\c$ /u:domain\\test_user contraseñaaqui
Specify a local user account on the remote computer, for example by removing the domain from the username parameter
/u:user_test
.
use the
/saved
-Parameter to save the credentials so that you are not prompted for the password later.
Create "no device" connections (no drive letter)
You may need to use a remote file share, but you don't want to assign a drive letter to it. In this case, simply delete the drive letter.
Let's create a file sharing connection without a drive letter, called a "no device" connection. Assuming you are on a Windows 10 PC in a domain environment with a Windows server hosting a file share:
1. Open a command prompt or PowerShell console as an administrator.
Related:How to run PowerShell as administrator
2. Create the "no device" connection by specifying theruta UNCFor the remote file, provide a username and password for authentication and press Enter.
net use \DEVSRV\c$ /u:domain\test_user passwordhere
If both the client computer and the remote Windows server are in an Active Directory domain, and you are logged on to the client computer with a domain user account, this is typically not helpful.
net use
in this situation. Now you can access these features without any additional steps. But if you need to authenticate with an alternate user account, this is useful.
The connection is established, but if you look in the file explorer, you don't see a connection. This connection is "no device".

3. Now confirm that the connection has been established by runningnet use
no parameters. You can see below that Windows knows there is a connection.

At this point, you can browse and work with the file share as if it were local, using the alternate user account credentials.

lasting connections
When you make new connections, Windows can keep those connections after a reboot or without calling persistence. EITHERnet use
The command has a parameter called/strong headed
which defines whether or not a connection persists after a reboot.
To ensure that the connection is maintained, add the/strong headed
Parameters for each attempt to establish a new connection, such as:
net use \\DEVSRV\c$ /persistent: ja
Mapped drives are not persistent by default.
(Video) Map Drives using Windows Batch File
Windows remembers the persistence settings of the last connection created. if you define
/strong headed
towardssimulator
For one connection, all subsequent connections are persistent unless you explicitly set it to be./strong headed
towardsno
🇧🇷 To ensure that all connections remain in the current session, usenet/persistent use: and
.
Advanced connection parameters
Most of the time, you only need the parameters discussed above to establish a connection. However, there may be times when you need to perform some advanced connection tasks.
Drive mapping writable (forced drive access)
Added in Windows 10 Build 1809, you can use/write
-Parameter to map a drive that bypasses all operating system caches and forces I/O through the disk.
increased security
onet use
The command also has two advanced parameters that increase security;/reguireintegrity
mi/Need privacy
through a resource calledUNC Protected Access🇧🇷 This feature "flags" the information on these shares to inform Multiple UNC Providers (MUPs) and UNC Providers of additional security requirements
Use of/requires integrity
The parameter provides additional integrity checks to block tampering attacks.
o/Need privacy
parameter commandsnet use
Use encryption to prevent third parties from seeing sensitive information in file share communications.
Delete network connections
Eventually, when you have connections configured and need to remove them, the/Clear
The parameter is your friend. To remove a non-persistent connection, enter the/Clear
and the UNC path to the network share as shown below.
net use /delete \\devsrv\c$

To remove a mapped drive, specify the drive letter and the mapped drive
net use f: \\devsrv\c$ /delete
conclusion
You should now have a good idea of what you can do with it.net use
Domain. This old but useful command is still used today and can still help you map network drives in Windows.
how will you usenet use
?