This blog will elaborate on the “net use” cmdlet of Command Prompt.
How do Connect to Network Drives on the Command Line Using the Cmdlet “net use”?
As described above, the stated command is responsible for connecting or disconnecting computers from shared resources.
Example 1: Use the “net use” Cmdlet to Map the Shared Directory on Server a Drive Letters
This illustration will assign a drive letter to a shared directory available on the server:
In the above code, specify the “net use” cmdlet and then assign the shared directory “letters” to the “e” drive.
Example 2: Connect the User Identifier to the Server
To connect the user identifier with the shared directory, use the following demonstration:
Following the above code:
- First, specify the “net use” cmdlet.
- Then, add the server-mapped shared directory.
- After that, enter the user account along with the identifier value.
Example 3: Use the “net use” Cmdlet to Disconnect From the Connected Directory
To disconnect the server from the connected directory, the below-stated command can be used::
In the above code snippet:
- First, use the “net use” cmdlet.
- After that, specify the network-mapped shared directory along with the “/delete” value to disconnect the directory.
Example 4: Use the “net use” Cmdlet to Connect With the Resource Memos
This example will connect the memos with the network drive. To do so, simply specify the “\memos” value after the network-mapped shared directory:
Example 5: Use the “net use” Cmdlet to Restore the Current Connections at Each Logon
To restore the current connection at each logon, execute the provided command::
According to the stated code above:
- Initially, specify the “net use” cmdlet.
- Then, add the value “/persistent:yes” to restore the connections at logon.
That was all about connecting drives to the network using the “net use” command.
Conclusion
The “net use” is a CMD cmdlet used to connect or disconnect the computer from network resources. Moreover, it maps the drives to a network server. This post illustrated the methods for connecting the network drive with the server.