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

Ian*_*ing 9 powershell

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:\>
Run Code Online (Sandbox Code Playgroud)

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

Den*_*son 8

尝试:

cmd /c rmdir testlink
Run Code Online (Sandbox Code Playgroud)

cmd 不知道 rm