Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a command that can be used from the command line to output a list of the mapped network drives on the local system and their location on the network to a text file?

This will only be used on Windows-based systems running Windows XP.

share|improve this question

4 Answers 4

up vote 59 down vote accepted

net use > mapped_drives.txt should dump a list of mapped drives to the text file mapped_drives.txt

alt text

Although I tested this on Windows 7, Microsoft says net use will work on Windows XP

share|improve this answer
Simple, and it works. Thanks! – user35406 Apr 29 '10 at 1:47
@MaterialEdge : Welcome! – Sathya Apr 29 '10 at 2:20
I can confirm that it works on Windows XP. – Peter Mortensen Jan 8 '14 at 8:59

Save the following as a .vbs file and run it. It'll create a MappedDrives.txt in the folder the vbs file is run from. You can replace the strComptuer with another computer's name and get the list off of a remote computer as well.

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objOutFile = objFSO.CreateTextFile(".\MappedDrives.txt")

Set colDrives = objWMIService.ExecQuery _
    ("Select * From Win32_LogicalDisk Where DriveType = 4")

For Each objDrive in colDrives
    objOutFile.WriteLine(objDrive.DeviceID & " (" & _
      objDrive.ProviderName & ")")

share|improve this answer
Woah. This is bad ass. No idea it was possible (1) to write a query for drives, and (2) to do it remotely. Awesome post. – kevinarpe Feb 26 '13 at 9:39

This works:

dir \\ComputerName\sharedDirectory

On Windows 7, the directory must be shared for "everyone". Right click the drive letter -> share with -> specific people, select "everyone" from the dropdown list and add it. Then the dir command should work.

share|improve this answer
He wants a list of shared directories. Not list the contents of a specific shared directory. – Oliver Salzburg Aug 14 '12 at 10:41

NET USE was only displaying the mapped drives for my current user and current connection. After some more googling, I got here:

The drive mapping info is stored in the Registry, look in HKEY_USERS\USER\Network

So I did a reg query HKEY_USERS to list the users (which were some windows codes), then I queried all of them individually, for example:

reg query HKEY_USERS\S-1-5-21-4205028929-649740040-1951280400-500\Network /s

If you query all of them, then you get all the mappings for all users.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.