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 许可协议。转载请注明出处!
相关文章
Windows平台下Git的安装与配置
一、下载 Git for Windows,主页:http://gitforwindows.org/ 点击页面中“Download”进入下载列表。可根据个人喜好选择下载版本。 这里选择下载最新版:Git-1.8.3-preview20130601.exe. 二、安装 下载完毕,双击开始安装: 1、除了AdvancedXXX选项,其余全选中 2、选择“Use Git Bash only” 3、选择
2021-12-18 · Windows · 约 1 分钟
2024年,提升Windows开发和使用体验实践 - 小工具篇
本来是一篇文章的,不知不觉写成了系列。 其实开工那几天就已经写好了长文,这几天一忙就没连着发了。 本文介绍一些 Windows 上用的小工具。
2024-02-29 · Windows · 约 1 分钟
修复winget命令找不到的问题
微软官方包管理器winget在Windows 10 1809以上版本中,用于快速安装、更新和管理应用程序。本文介绍了因系统环境变化导致winget命令失效的问题,分析了可能原因,并提供了解决方案及预防措施,包括修复命令、定期更新检查、备份环境变量等。
2025-04-04 · Windows · 约 1 分钟
Windows10-快捷键大全,整理+排版
前言 偶然在微软官网看到的,整理了一下,非常全面。不只有Windows10能用,大部分快捷键在7/8/8.1里都是通用的。 发现这东西对提高效率帮助很大啊,下面是整理之后的。 复制、粘贴及其他常规的键盘快捷方式 | 按键 | 操作
2021-12-18 · Windows · 约 1 分钟
讨论
共 0 条加载评论中…