返回文章列表文章索引阅读全文
STARBLOG / 阅读手记
Windows

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?

曦远 (DealiAxy)约 8 分钟
目录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.

image-20251002133824288

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 /scannow to fail), DISM is needed first to repair WinSxS.

References

https://fast.v2ex.com/t/1002754

_EOF_

Using the command line to delete a Windows mapped network drive

本文作者:
程序设计实验室
版权声明:
本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!

相关文章

IT之家学院:让Win10文件管理器的详细信息窗格显示更多信息

当你在Windows的资源管理器中将详细信息窗格设置为可用,然后选中一个文件时(IT之家小编选中了一个exe文件),你将在窗口的右半部分看到这个文件的一些信息,包括修改日期、创建日期、文件大小和可用性,不过对于一些用户来说,这些信息十分有限,还是不够详细。 在这篇文章中,IT之家将为大家演示如何进行设置,以使文件资源管理器可在详细信息窗格中显示更多的关于已被选中的文件的有用信息。 下文中的方法适用

2021-12-18 · Windows · 约 1 分钟

讨论

共 0 条

良言一句三冬暖,恶语伤人六月寒。

加载评论中…

Using the command line to delete a Windows mapped network drive · StarBlog