Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

up vote 4 down vote accepted

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
1  
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

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
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

Your Answer

 
discard

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.