Connecting or disconnecting network drives via the command prompt under Windows 11, 10, ... or MS Server without mouse clicks is a very practical option!
1.) ... Mapping a network drive or a folder!
|(Image-1) Map network drives via the command prompt under Windows!|
2.) Make network paths permanently available as a drive!The permanent connection can be achieved: /persistent:Yes ! In the example here, drive M: is permanently assigned to the path "\\fritz-nas\nas\My documents" If not specified, it is like /persistent:No By default, mapped drives are not persistent. If we were to map drives using the commands mentioned so far, the mapped drives would disappear when you restart your computer.
net use M: "\\ fritz-nas\nas\My documents" /persistent:Yes
3.) Delete assigned drives, individually or all!If you ever need to delete a mapped network drive, all you have to do is specify the drive letter and add the /delete parameter. For example, the following command would delete the drive mapping to "\\fritz-nas\nas\My Documents" , to which we previously assigned drive M
net use M: /delete
You can use the asterisk * wildcard in case you ever want to delete / unlock all of your mapped drives at once. Of course, only the release or drive letter assignment is canceled! (... see Image-2 Point 1 to 4)
net use * /delete
|(Image-2) Unlink or remove network drives on all MS Windows OS|
4.) Why the network paths as drive letters?
Mapping a drive to a network share assigns a drive letter to that share, making it easier to work with. We'll use the net use command in the command prompt to map a network drive for this tutorial. You can use the same command in PowerShell as well if you prefer.
See also ► How can I map a network drive under Windows 11?
FAQ 123: Updated on: 5 November 2021 20:21