Make it so being in the working directory doesn't leave the directory open #1482

Open
opened 2026-01-30 22:28:26 +00:00 by claunia · 0 comments
Owner

Originally created by @ehumphrey-payments on GitHub (Jun 3, 2019).

Summary of the new feature/enhancement

Windows can't delete or move folders that are currently part of the path of the working directory in any command shell in Windows Terminal. This is because Windows believes it is "open in another program". This is a pain, as one has to seek out and close any Terminal windows accessing the folder in order to perform basic filesystem operations on it.

image

What it would solve

Fixing this would make it possible to delete or move the directory (folder) while it is open in Windows Terminal.This is how it already works in macOS and Ubuntu.

Proposed technical implementation details

Don't actually leave open the folder constantly open when the working directory is changed with cd or chdir. Only show that it's open visually within Terminal. Open and close the directory as needed (e.g. any time a command is executed within the working directory).

Deleting the directory in the path of working directory would change the working directory to temp/garbage folder or just reset it to one of the defaults. This is how Unix-based operating systems / terminal emulators handle it. (1903 breaks VirtualBox, so I can't screenshot it right now.)

Hopefully, this is actually an issue with Command Prompt that can be resolved with Windows Terminal, and not an issue that requires a change in the shell or Windows. I assume this because the issue currently happens with every shell.

Originally created by @ehumphrey-payments on GitHub (Jun 3, 2019). ### Summary of the new feature/enhancement Windows can't delete or move folders that are currently part of the path of the working directory in any command shell in Windows Terminal. This is because Windows believes it is "open in another program". This is a pain, as one has to seek out and close any Terminal windows accessing the folder in order to perform basic filesystem operations on it. ![image](https://user-images.githubusercontent.com/1473776/58805175-91194900-85e1-11e9-8d35-d5441c0ffdc3.png) ### What it would solve Fixing this would make it possible to delete or move the directory (folder) while it is open in Windows Terminal.This is how it already works in macOS and Ubuntu. ### Proposed technical implementation details Don't actually leave open the folder constantly open when the working directory is changed with `cd` or `chdir`. Only show that it's open visually within Terminal. Open and close the directory as needed (e.g. any time a command is executed within the working directory). Deleting the directory in the path of working directory would change the working directory to temp/garbage folder or just reset it to one of the defaults. This is how Unix-based operating systems / terminal emulators handle it. (1903 breaks VirtualBox, so I can't screenshot it right now.) Hopefully, this is actually an issue with Command Prompt that can be resolved with Windows Terminal, and not an issue that requires a change in the shell or Windows. I assume this because the issue currently happens with every shell.
claunia added the Issue-FeatureNeeds-TriageNeeds-Tag-FixProduct-Cmd.exe labels 2026-01-30 22:28:26 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#1482