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:\>
The error is related to the fact that rm -force tries to remove items inside wherever the link is pointing. How can I remove this thing using the command line? Where can I report powershell/shell bugs? It seems powershell is not on ms connect.
Try:
cmd
doesn't know aboutrm
Use the mountvol /d command
List the GUID:
PS C:> Mountvol
then
PS C:> mountvol \?\Volume{2eca078d-5cbc-43d3-aff8-7e8511f60d0e}\ /d
replacing the relevant GUID in the above
I use .net from powershell to do this
Where $Path is equal to the path of your symlink. rmdir does not provide consistent result and will almost always return an error when run from powershell, regardless if it was successful or not.