AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 67770
Accepted
Ian Kelling
Ian Kelling
Asked: 2009-09-23 09:35:32 +0800 CST2009-09-23 09:35:32 +0800 CST 2009-09-23 09:35:32 +0800 CST

powershell如何删除损坏的符号链接

  • 772
PS C:\> cmd /c mklink /d testlink non-existent-dir
symbolic link created for testlink <<===>> non-existent-dir
PS C:\> rm .\testlink
Remove-Item : C:\testlink is a NTFS junction point. Use the Force parameter to delete or modify.
At line:1 char:3
+ rm <<<<  .\testlink
    + CategoryInfo          : WriteError: (C:\testlink:DirectoryInfo) [Remove-Item], IOException
    + FullyQualifiedErrorId : DirectoryNotEmpty,Microsoft.PowerShell.Commands.RemoveItemCommand

PS C:\> rm -force .\testlink
Remove-Item : Could not find a part of the path 'C:\testlink'.
At line:1 char:3
+ rm <<<<  -force .\testlink
    + CategoryInfo          : WriteError: (C:\testlink:String) [Remove-Item], DirectoryNotFoundException
    + FullyQualifiedErrorId : RemoveItemIOError,Microsoft.PowerShell.Commands.RemoveItemCommand

PS C:\>

该错误与 rm -force 尝试删除链接指向的任何地方的项目有关。如何使用命令行删除这个东西?我在哪里可以报告 powershell/shell 错误?似乎powershell不在ms connect上。

powershell
  • 3 3 个回答
  • 7459 Views

3 个回答

  • Voted
  1. Best Answer
    Dennis Williamson
    2009-09-23T12:00:11+08:002009-09-23T12:00:11+08:00

    尝试:

    cmd /c rmdir testlink
    

    cmd不知道rm

    • 8
  2. SS64
    2009-09-23T15:55:40+08:002009-09-23T15:55:40+08:00

    使用 mountvol /d 命令

    列出 GUID:

    PS C:> Mountvol

    然后

    PS C:> mountvol \?\Volume{2eca078d-5cbc-43d3-aff8-7e8511f60d0e}\ /d

    替换上面的相关 GUID

    • 1
  3. pizzim13
    2011-12-02T07:45:21+08:002011-12-02T07:45:21+08:00

    我使用 powershell 中的 .net 来执行此操作

    [System.IO.Directory]::Delete($Path,$true)
    

    其中 $Path 等于符号链接的路径。rmdir 不提供一致的结果,并且在从 powershell 运行时几乎总是会返回错误,无论它是否成功。

    • 1

相关问题

  • 资源锁和电源外壳

  • 脚本 - 如何断开远程桌面会话?

  • 如何限制向通讯组发送到外部地址?

  • Powershell对值与数组的作用不同?

  • Windows Powershell Vim 键绑定

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    从 IP 地址解析主机名

    • 8 个回答
  • Marko Smith

    如何按大小对 du -h 输出进行排序

    • 30 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    Windows 中执行反向 DNS 查找的命令行实用程序是什么?

    • 14 个回答
  • Marko Smith

    如何检查 Windows 机器上的端口是否被阻塞?

    • 4 个回答
  • Marko Smith

    我应该打开哪个端口以允许远程桌面?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    MikeN 在 Nginx 中,如何在维护子域的同时将所有 http 请求重写为 https? 2009-09-22 06:04:43 +0800 CST
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    0x89 bash中的双方括号和单方括号有什么区别? 2009-08-10 13:11:51 +0800 CST
  • Martin Hope
    kch 如何更改我的私钥密码? 2009-08-06 21:37:57 +0800 CST
  • Martin Hope
    Kyle Brandt IPv4 子网如何工作? 2009-08-05 06:05:31 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve