Using the command line to delete a Windows mapped network drive
Windows still has this broken system that freezes the right-click menu even now? Deleting mapped drives via command line counts as a task. Really, nobody fixes this old problem from the XP era?
目录6 个章节
Preface
I have to complain a bit—Windows is really a hot mess.
I've been criticizing Windows since college, and I can't believe it's still this bad now 🤣
I recently upgraded my NAS.
Previously, these three network mapped drives (W:, X:, Y:) were mapped to the TKL FileServer via SMB.
Now that I've migrated to TrueNAS, I need to remap them.
But these right-click menus keep freezing.

Solution
Windows Explorer requests the shared status (capacity, thumbnails, context menu extensions) of these shares when you right-click. If the NAS is unresponsive or the network is slow, it can freeze.
You can remove them via the command line instead.
Open PowerShell with administrator privileges.
net use
Output
$ net use
New connections will be remembered.
Status Local Remote Network
-------------------------------------------------------------------------------
Disconnected W: \\192.168.10.201\ssd Microsoft Windows Network
Disconnected X: \\192.168.10.201\data Microsoft Windows Network
Reconnecting Y: \\192.168.10.201\pan Microsoft Windows Network
The command completed successfully.
Delete the corresponding network drives.
net use X: /delete
net use Y: /delete
net use W: /delete
If you encounter the prompt "The connection is currently in use," add /y to force the deletion.
net use X: /delete /y
Refresh File Explorer, and the drives will no longer appear.

Suggestion
I read on the forum that this issue has existed since the XP era.
I didn't expect Windows 10 to still not have fixed it 🤣
The suggestion is to place network drive mappings inside folders to avoid lag.
Additionally, Windows also has an issue where opening Task Manager causes lag. I used the system integrity check commands, which improved the situation afterward.
sfc /scannow
DISM /Online /Cleanup-Image /RestoreHealth
1. sfc /scannow
- SFC = System File Checker
- Checks whether protected files in the system have been modified or corrupted.
- If issues are found, it will attempt to repair them using copies from the WinSxS cache.
- However, this assumes that WinSxS itself is intact.
2. DISM /Online /Cleanup-Image /RestoreHealth
- DISM = Deployment Image Servicing and Management
- Operates at a more fundamental level, primarily repairing the WinSxS component store (the system's "backup parts warehouse").
- Parameter explanation:
/Online→ Applies to the currently running system (not an offline image)./Cleanup-Image→ Performs cleanup or repair on the system image./RestoreHealth→ Checks and repairs corrupted files within WinSxS.
- If WinSxS itself is corrupted (which causes
sfc /scannowto fail), DISM is needed first to repair WinSxS.
References
_EOF_
Using the command line to delete a Windows mapped network drive
- 本文作者:
- 程序设计实验室
- 版权声明:
- 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
相关文章
在 Windows11 上启用 ssh-agent
微软的坑真多!!!
2026-08-25 · Windows · 约 1 分钟
如何阻止Win10重置默认应用?
前言 Win10比之前版本的Windows系统更现代,然而却不见得更好用,喜欢自作主张重置默认应用就是一个大问题。 就像这样,真的是烦。 解决方法 改注册表。 新建一个 去除重置默认应用.reg 的注册表文件,粘贴一下代码。 Windows Registry Editor Version 5.00 ;Description: Prevents Windows 10 from resetting
2021-12-18 · Windows · 约 1 分钟
2024年,提升Windows开发和使用体验的实践经验 - RIME输入法
上一篇文章介绍了 Windows 下的包管理器,本文继续介绍输入法。 事实上 Windows 的输入法生态比 Linux/Mac 丰富很多,不过很多国产输入法存在窃取隐私、植入广告、乱安装流氓软件等问题,现在有开源的 RIME 输入法可以选择,何必受这气呢
2024-02-29 · Windows · 约 1 分钟
用 dnot.sh 替代 Windows Defender
dnot.sh 往安全中心塞了个假 AV 签名,Defender 就乖乖下岗了——至少监控上看。实际还得再跑 extra-strip.bat 才能真关,这两步缺一不可,属实有点折腾。搞定即裸奔,胆子小的别碰。
2026-09-17 · Windows · 约 1 分钟
讨论
共 0 条加载评论中…