Home » Questions » Computers [ Ask a new question ]

How do I connect to a network share via the Windows Command Prompt?

How do I connect to a network share via the Windows Command Prompt?

Is there any way to connect to a network share via cmd.exe?

Asked by: Guest | Views: 162
Total answers/comments: 2
bert [Entry]

"use net use, example:

net use X: \\SERVER\Share

Where X: is the drive letter you wish to map the share to, and \\SERVER\Share is the UNC path to the share. This should make the share visible in My Computer and the command line as well like all other shares mapped through the GUI.

In order to later disconnect the share, you would use

net use X: /delete"
bert [Entry]

"If you only want to perform a few actions on the drive (such as move, copy, etc.) then you can use the command line syntax and \ \SERVER\FOLDER\FILE

Example:

'copy \ \Server-01\Folder-01\MyFile.pdf'

That command will copy whatever file you specify into the CWD (Current Working Directory).

Likewise:

md \ \Server-01\NewFolder

To make a directory

rd \ \ Server-01\DeleteFolder

To delete a directory

This method is really only useful if you want to perform one or two operations across the network and can't be bothered mapping the network drive. Or, as in my case, where the network drive is in a different state and the lag when working with files and folders is painful. It's easier to use command line to copy the file to my desktop and view it from there, than try and open it across the network.

Otherwise, I'd use pushd and popd as suggested by Dave Webb."