I ended up deleting the whole Code folder within the C:\Users\AppData\Roaming.
Note: You have to check the box - view Hidden Files to see these folders within File Explorer.
This solved it.
There must have been some weird corrupted cache issue at the heart of this.
I found this in C:\Users<profile>\AppData\Roaming\Code\logs<datetimestamp>\ptyhost.log
[2022-10-17 07:25:50.695] [ptyhost] [warning] Couldn't get layout info, a terminal was probably disconnected Could not find pty on pty host
[2022-10-17 07:25:54.040] [ptyhost] [warning] Shell integration cannot be enabled for executable "C:\Windows\System32\cmd.exe" and args []
[2022-10-17 07:26:57.939] [ptyhost] [warning] Shell integration cannot be enabled for executable "C:\Windows\System32\cmd.exe" and args []
I think it is related to this.
BTW: I had tried adding a couple of PowerShell VSCode IDE Extensions when things went awry. IIRC they were:
- PowerShell
- PowerShell Preview
I had upgraded PowerShell to the latest version 7 too.
$PSVersionTable yielded the following from the respective executables.
| Executable Path | Version |
|---|---|
| C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe | 5.1.17763.1852 |
| C:\Program Files\PowerShell\7\pwsh.exe | 7.2.6 |
Maybe that combo hosed things
Follow up note: Whilst it seemed to have fixed the issue once... soon after the problem manifested itself again. This time I couldn't reset VS Code to a working environment.
- Then I realised had opened the Project folder in the explorer on the left of the IDE.
- I had a subfolder that had a PS1 file within that.
- It didn't have its own .vscode\settings.json
- When I copied it down from the parent folder, suddenly everything worked again.
.vscode\settings.json just contained this:
{
}
Again this ended up being a one time solution. I ended up back at:
Shell activation failed to activate for cmd.exe
I posted this as a new ticket here
- In the end I found this to be more of a display issue than anything else!
- You can actually type cls then hit ENTER, to restore things to the status quo.
- The Terminal section is black with no prompt to begin with. But you can type in it!!!
- Perhaps the Prompt is black text on a black background initally, since when you start typing cls, it's quite a way to the right of the left margin.
VS Code Shell Integration support
What is the best workaround for "Shell integration unavailable"?
Test: Terminal shell integration
Shell integration failed to activate
Videos
I ended up deleting the whole Code folder within the C:\Users\AppData\Roaming.
Note: You have to check the box - view Hidden Files to see these folders within File Explorer.
This solved it.
There must have been some weird corrupted cache issue at the heart of this.
I found this in C:\Users<profile>\AppData\Roaming\Code\logs<datetimestamp>\ptyhost.log
[2022-10-17 07:25:50.695] [ptyhost] [warning] Couldn't get layout info, a terminal was probably disconnected Could not find pty on pty host
[2022-10-17 07:25:54.040] [ptyhost] [warning] Shell integration cannot be enabled for executable "C:\Windows\System32\cmd.exe" and args []
[2022-10-17 07:26:57.939] [ptyhost] [warning] Shell integration cannot be enabled for executable "C:\Windows\System32\cmd.exe" and args []
I think it is related to this.
BTW: I had tried adding a couple of PowerShell VSCode IDE Extensions when things went awry. IIRC they were:
- PowerShell
- PowerShell Preview
I had upgraded PowerShell to the latest version 7 too.
$PSVersionTable yielded the following from the respective executables.
| Executable Path | Version |
|---|---|
| C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe | 5.1.17763.1852 |
| C:\Program Files\PowerShell\7\pwsh.exe | 7.2.6 |
Maybe that combo hosed things
Follow up note: Whilst it seemed to have fixed the issue once... soon after the problem manifested itself again. This time I couldn't reset VS Code to a working environment.
- Then I realised had opened the Project folder in the explorer on the left of the IDE.
- I had a subfolder that had a PS1 file within that.
- It didn't have its own .vscode\settings.json
- When I copied it down from the parent folder, suddenly everything worked again.
.vscode\settings.json just contained this:
{
}
Again this ended up being a one time solution. I ended up back at:
Shell activation failed to activate for cmd.exe
I posted this as a new ticket here
- In the end I found this to be more of a display issue than anything else!
- You can actually type cls then hit ENTER, to restore things to the status quo.
- The Terminal section is black with no prompt to begin with. But you can type in it!!!
- Perhaps the Prompt is black text on a black background initally, since when you start typing cls, it's quite a way to the right of the left margin.
Closing VSCode, verifying that powershell works, then reopening it worked for me.
This is what is literally stopping me from using Roo-Cline. On Windows, set the PowerShell security policy to remote signed, set the default profile to PowerShell, updated to the latest vsCode...
Before the AI executes a command, I get an error when it launches the terminal, or tries, and it is trying to use a cwd command to launch it in a folder that doesn't exist.
Using Gemini flash at the moment just to test whether it can execute or see terminal output.
Anybody have any other suggestions to try?
There are a few potential solutions for this issue.
Make sure that you have the latest version of VS Code and the Shell Integrate extension installed.
Check that the integrated terminal in VS Code is set to the shell you want to use (e.g. PowerShell, Command Prompt, Bash).
Try running VS Code as an administrator.
If you are using Windows, try adding the path of the shell you want to use (e.g. C:\Windows\System32\bash.exe) to the
"terminal.integrated.shell.windows"setting in your VS Code settings.You can also try reinstalling VS Code and your extensions.
If none of the above solutions work, you can try searching for specific error messages in the output panel of VS Code or in the output of the terminal.
You can just close your VS code and restart it again.
Install Git from https://git-scm.com/download/win
Open Visual Studio Code and press and hold Ctrl + ` to open the terminal.

Open the command palette using Ctrl + Shift + P.
Type - Select Default Profile
Select Git Bash from the options
Click on the + icon in the terminal window
The new terminal now will be a Git Bash terminal. Give it a few seconds to load Git Bash

You can now toggle between the different terminals as well from the dropdown in terminal.

You no longer need to type in bash.exe path manually. This answer is deprecated. Now you can switch to bash directly, if you have git installed in the default path. If you installed git to a different path you need to use the below solution.
Install Git from https://git-scm.com/download/win.
Then open Visual Studio Code and open the command palette using Ctrl + Shift + P. Then type "open user setting", and then select "Open User Settings" from the drop down menu.

Then this tab will open up with default settings on left and your settings on the right:

Now copy this line of code to your own settings page (the pane on the right hand side) and save -
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
Note: "C:\\Program Files\Git\bin\bash.exe" is the path where the bash.exe file is located from the Git installation. If you are using the Windows Subsystem for Linux (WSL) Bash shell, the path would be "C:\Windows\System32\bash.exe"
Now press Ctrl + ` to open up the terminal from Visual Studio Code. And you will have Bash -
