We can map a network drive from windows command line using the command net use. Syntax is given below.
net use z: \\remotepc\sharename
The above command maps the drive letter Z: to the network share \\remotepc\sharename. If the logged in user has authorized access to this network share, the above command completes successfully without asking the user to provide username/password. Otherwise it will prompt to supply the credentials of an account authorized to access the share. Upon providing the required credentials, the share gets mapped to the drive Z:
We can also use * instead of Z:. This will automatically pick up the unused drive letter starting from Z:
You can alsp specify username and password in net use command. See examples below.
net use * \\remotepc\share /u:domainname\username password
If you don’t want to type the password in plain text in the windows command line you can specify just the user name. Net use will prompt you for the password.
net use * \\remotepc\share /u:domainname\username
You can use Net use command to map webdav shares also.
Once the network share is mapped, you can start using it like a local drive. You can open the network share in explorer with the drive letter. Open explorer and specify drive letter in the address bar(Z:)
You can also do ‘start Z:’ from command prompt. This would open the network drive in explorer.
Map system drive (C:) of remote computer
If you have administrator access to the remote computer then you can map the system drive or any other drive of the remote computer with the below command.
net use \\remotepc\C$ /u:username password