Mount and unmount network drives in Windows at the command prompt, here’s how.
Network drives can be connected and disconnected not only via the Explorer, but also via the command prompt. If you are often on different networks, you can quickly connect to network shares for the respective network.
Mount share as drive
A connection can be made with the following command:
net use Z: \\computername\share password /user:domain\username
net use Z: \\192.168.178.96\d taschenbier /user:192.168.178.96\userle
The share is mounted as drive z:.
In this case, the connection is included until the next restart. To mount a share permanently, we add the parameter “/persistent:yes”.
net use Z: \\192.168.178.96\d taschenbier /user:192.168.178.96\userle /persistent:yes
Disconnect network drive
Network drives can of course be disconnected again. Individual drives can be separated in this way:
net use z: /delete
All network drives can also be disconnected in one go:
net use * /delete /y