Cannot rename folder in File Explorer once opened in Windows Terminal #20859

Closed
opened 2026-01-31 07:26:05 +00:00 by claunia · 6 comments
Owner

Originally created by @ehea617 on GitHub (Nov 20, 2023).

Windows Terminal version

1.18.2822.0

Windows build number

10.0.22631.0

Other Software

No response

Steps to reproduce

  1. Navigate to a folder in File Explorer and choose Open In Terminal
  2. Navigate out of the folder (cd ..) using the Terminal
  3. Attempt to rename the folder in File Explorer
  4. You will get an error stating that the action can not be completed because the folder is in use
    image
  5. Close Windows Terminal
  6. Attempt to rename the folder again from File Explorer and the rename will succeed

Expected Behavior

You should be able to rename the folder in File Explorer at minimum once you are navigated out of the folder in Windows Terminal. In cmd.exe or powershell.exe you are able to rename the folder through File Explorer even if you are currently in the directory in the terminal.

Actual Behavior

Unable to rename folder until Windows Terminal is fully closed. The folder appears to be write-locked by Windows Terminal.

Originally created by @ehea617 on GitHub (Nov 20, 2023). ### Windows Terminal version 1.18.2822.0 ### Windows build number 10.0.22631.0 ### Other Software _No response_ ### Steps to reproduce 1. Navigate to a folder in File Explorer and choose Open In Terminal 2. Navigate out of the folder (cd ..) using the Terminal 3. Attempt to rename the folder in File Explorer 4. You will get an error stating that the action can not be completed because the folder is in use ![image](https://github.com/microsoft/terminal/assets/12926544/74418bc0-300f-4834-a49a-3a5f9b381819) 5. Close Windows Terminal 6. Attempt to rename the folder again from File Explorer and the rename will succeed ### Expected Behavior You should be able to rename the folder in File Explorer at minimum once you are navigated out of the folder in Windows Terminal. In cmd.exe or powershell.exe you are able to rename the folder through File Explorer even if you are currently in the directory in the terminal. ### Actual Behavior Unable to rename folder until Windows Terminal is fully closed. The folder appears to be write-locked by Windows Terminal.
claunia added the Resolution-By-DesignNeeds-TriageIssue-BugNeeds-Attention labels 2026-01-31 07:26:05 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Nov 20, 2023):

What shell are you running in the Terminal? PowerShell/?

@zadjii-msft commented on GitHub (Nov 20, 2023): What shell are you running in the Terminal? PowerShell/?
Author
Owner

@ehea617 commented on GitHub (Nov 20, 2023):

What shell are you running in the Terminal? PowerShell/?

I am using Windows PowerShell as my default shell.

@ehea617 commented on GitHub (Nov 20, 2023): > What shell are you running in the Terminal? PowerShell/? I am using Windows PowerShell as my default shell.
Author
Owner

@zadjii-msft commented on GitHub (Nov 20, 2023):

I think we fixed this for the Terminal in 1.18, but IIRC PowerShell leaves itself in the CWD it was created in, even after you cd out of that directory. You might be able to check by opening a Command Prompt tab, and then cd'ing somewhere else, and closing the pwsh tab.

@zadjii-msft commented on GitHub (Nov 20, 2023): I think we fixed this for the Terminal in 1.18, but IIRC PowerShell leaves itself in the CWD it was created in, even after you `cd` out of that directory. You might be able to check by opening a Command Prompt tab, and then cd'ing somewhere else, and closing the pwsh tab.
Author
Owner

@ehea617 commented on GitHub (Nov 20, 2023):

I think we fixed this for the Terminal in 1.18, but IIRC PowerShell leaves itself in the CWD it was created in, even after you cd out of that directory. You might be able to check by opening a Command Prompt tab, and then cd'ing somewhere else, and closing the pwsh tab.

Closing the Windows PowerShell tab allows renaming the folder. Additionally, If I go into the Windows Terminal settings and set the default profile to Command Prompt the issue does not occur.

@ehea617 commented on GitHub (Nov 20, 2023): > I think we fixed this for the Terminal in 1.18, but IIRC PowerShell leaves itself in the CWD it was created in, even after you `cd` out of that directory. You might be able to check by opening a Command Prompt tab, and then cd'ing somewhere else, and closing the pwsh tab. Closing the Windows PowerShell tab allows renaming the folder. Additionally, If I go into the Windows Terminal settings and set the default profile to Command Prompt the issue does not occur.
Author
Owner

@DHowett commented on GitHub (Nov 21, 2023):

Unfortunately, this isn't Terminal can help with. PowerShell is running with that folder locked (even if it is not currently using it). Windows is more strict than other platforms with regards to deleting files that are open.

@DHowett commented on GitHub (Nov 21, 2023): Unfortunately, this isn't Terminal can help with. PowerShell is running with that folder locked (even if it is not currently using it). Windows is more strict than other platforms with regards to deleting files that are open.
Author
Owner

@DHowett commented on GitHub (Nov 21, 2023):

It may be worth filing an issue over on the PowerShell repository!

@DHowett commented on GitHub (Nov 21, 2023): It may be worth filing an issue over on the [PowerShell repository](https://github.com/powershell/powershell)!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20859