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

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Windows 7

When moving from office A to office B, I have a script that deletes (net use x: /d) the drive mappings from office A... but the drive links remain prominently visible in Windows Explorer / My Computer. They are prominently displayed under Network Location.

The disconnected links have a big red X through them and right-clicking on them and choosing Disconnect results in an error message saying that that drive mapping no longer exists.

How can I force Windows to remove them once they've been disconnected?

Edit: Without rebooting? (Scriptable)

share|improve this question
up vote 13 down vote accepted

There is an easy way to do this: restart Windows Explorer (without shutting down). You could do this with a batch file, like the following:

@echo off
net use * /delete /noconfirm
taskkill /f /IM explorer.exe
net use x: \\myServer\mySHaredFolder
share|improve this answer
Was /noconfirm added in Windows 7? Vista does not recognize it (and consequently the delete command fails) – Michael Apr 24 '13 at 3:54
Note to Googlers: "/noconfirm" error still present in Windows 8.1 – MickyD Jun 9 '15 at 11:22

First, you need have a "Shared Folder" on your hard drive. If you haven't got one already, create a new folder on your hard drive called "Shared", then right-click it and select properties. Click the Sharing tab and tick the "Share this folder" box.

Next, click "My Computer" and in the Tools Menu, click "Map Network Drive".

Notice the little down-arrow next to the drive letter shown. Click the arrow to get a list of letters. Select the one you want to delete, then browse for your Shared folder and select it.

By this means, you will assign the drive letter to a real folder. Make sure the "reconnect at login" box is un-ticked.

Click the Finish button to get a warning. Answer "Yes" and the Shared folder will open. Close it.

Next, right-click the drive in My Computer and select disconnect. Ah, I hear you say, but it is still there! Reboot and it should now be gone.

share|improve this answer
Excellent answer, David, thank you. I need to force removal without rebooting, though. Possible? – gibberish Jun 11 '12 at 18:45
I think you can you log out and log back in without rebooting the entire system. Other than that, I'm out of ideas. Perhaps someone can chime in on this. – superuser Jun 11 '12 at 18:54
This doesn't seem to work if you get the message about having to have a user name and password on the computer for sharing to work. – Michael Apr 24 '13 at 3:58

You can restart windows explorer using Task Manager. Kill the explorer process, then go to File > New Task (run) and type explorer. Disconnected drives should be gone! (Windows 7 Tested)

share|improve this answer
There are now two accounts both named Baines -- see – Kevin Panko Nov 11 '14 at 17:13

(Windows 8.1 Tested) restart Windows Explorer by killing and restarting the process in the Task Manager. Right-click Windows Explorer -> Restart. Done.

share|improve this answer
The only thing that worked (Win 10). – StepTNT Jan 11 at 19:24

for those who have SQL Server Management Studio in your pc, just run this query:

Exec master.dbo.xp_cmdshell 'net use x: /delete'

** change the 'x' according to the drive name..

share|improve this answer
How is this an improvement over performing net use x: /delete /noconfirm at the command prompt? – Jason Aller May 22 '15 at 5:04

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.