Windows – How to remove disconnected drives from Windows Explorer

windows 7

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?

Without rebooting? (Scriptable)

Best Answer

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