-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New-PSDrive fails with a UNC path with a trailing backslash when combined with -Persist #8242
Copy link
Copy link
Closed
Labels
Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-FixedThe issue is fixed.The issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management modulecmdlets in the Microsoft.PowerShell.Management module
Metadata
Metadata
Assignees
Labels
Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-FixedThe issue is fixed.The issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management modulecmdlets in the Microsoft.PowerShell.Management module
Without the
-Persistswitch, you can optionally specify the root path with a trailing\- in other words: whether or not a trailing\is present makes no difference.If you add the
-Persistswitch (Windows-only, only with single-letter drive names), a path with a trailing\causes an obscure error:Note that successful creation of the drive (without
-Persist) actually retains the trailing\, as reflected in the.Rootproperty of the drive, but it seems to have to no ill effects.Note: A separate problem is that trying to use
-Persiston Unix-like platforms, where it is fundamentally unsupported, does not indicate that fact in its error message - see #8250Steps to reproduce
On Windows:
Expected behavior
Drive creation should succeed.
Actual behavior
The following error occurs:
Simply removing the trailing
\makes the problem go away.Environment data