Skip to content

Automatic network drive mapping when opening CMD from UNC path #19514

@fowl2

Description

@fowl2

Description of the new feature

It'd be great if when opening a terminal from a UNC path, a free drive letter was automatically mapped and when no longer in use it was automatically unmapped.

Currently the easiest way to do this is copy+pasting the path and using pushd, thenpopd if I remember when done to unmap.

Extra credit: notification bar to show that it's been mapped.

Current behavior:

  1. Have "Command Prompt" set as default profile in Windows Terminal
  2. Browse to a UNC path (\\servername\sharename\) in File Explorer
  3. Right click the background or a folder and select "Open in Terminal"

Output

'\\servername\sharename\path\to\directory'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.
Microsoft Windows [Version 10.0.26100.6899]
(c) Microsoft Corporation. All rights reserved.

C:\Windows>

Proposed technical implementation details

For finding a free drive letter and mapping see how pushd does it?

For automaticlly unmapping, Maybe Windows has a "unmap on last close" flag? Otherwise just make an attempt when the terminal closes. I guess you could show a notification bar if it fails with a retry button.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-FeatureComplex enough to require an in depth planning process and actual budgeted, scheduled work.Needs-Tag-FixDoesn't match tag requirementsNeeds-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions