NET USE and SUBST are two commands for mapping a drive letter to a network or local path.

For example, to map a network share:

net use Z: \\zzz.buzz\share
subst Y: \\zzz.buzz\share

or to map a local path:

subst X: C:\Windows
subst W: D:\

and then delete them:

net use /d Z:
subst /d Y:

However, effects of both of these commands are only visible to the user who carried out these commands, i.e. a drive letter mapped by user A is not visible to user B, and user B can still use that letter to map to another path. Unless the drive letter is created by SYSTEM account, which is visible to all users.

To run command under SYSTEM account, you may use PsExec:

psexec -s your-command command-argument
psexec -s net use Z: \\zzz.buzz\share

For drive letters created by NET USE, they are recorded under registry key HKEY_USERS\<UserSID>\Network.


The same applies to Windows API WNetAddConnection2 function and WNetAddConnection3 function as well.

References