Thomas' Tech Tips

How to mount network drive from command-line on Windows

19 April 2023 - Thomas Damgaard

On Windows, you can mount an SMB shared folder as a network drive. It is often useful to be able to mount such a drive from a command-line or batch-script.

Mounting a network drive from command-line is done line this:

net use X: \\servername\sharename /user:domain\username "password"

Note that the network drive will only be mounted for the duration of the script. If you need the network drive to be mounted permanently, you can add the /persistent:yes parameter to the net use command


This should work on all modern versions of Windows, including:

Filed under: howto, samba, tips, windows

Back to article list