With the command net use, a network drive can be mapped from a Windows command line. See below for details.
How to Map Network Drive From Command Line?
net use z: \\remotepc\sharename
Z: is mapped to the network share //remotepc/sharename by the above command. A network share is accessed by the logged-in user without asking for a username and password if the user has authorization rights to access it. In any other case, it will request the credentials of an account that has access to the share. The drive Z account credentials must be entered otherwise: Z: can also be substituted with *. By doing this, drive letters will start from Z:
Additionally, the net use command allows you to specify your user name and password. Below is an example.
net use * \\remotepc\share /u:domainname\username password
Instead of typing a plain text password, you can specify just the user name instead, so that you do not need to type a password. When you are prompted for a password, you can type it.
net use * \\remotepc\share /u:domainname\username
Mapping shares from webdav can also be done with the net use command.
You can start using the network share as a local drive as soon as it is mapped. The drive letter can be used in Explorer to access the network share. Navigate to the drive letter (Z:) by entering the drive letter in Explorer.
The command prompt also allows you to do ‘start Z’. Explorer would be opened by this command.
Computer’s system drive (C:) is mapped –
Below is the command you can run if you have administrator privileges on the remote computer.
net use \\remotepc\C$ /u:username password
You may also like: Create Empty File Linux – Windows CMD [Bash/Powershell]