2

I want to use Windows Terminal as my debug console in Visual Studio Code. I don't like VS Code's integrated terminal. How do I do It?

Here is my launch.json file in my python project:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File External Terminal",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": true
        }
    ]
}
starball
  • 20,030
  • 7
  • 43
  • 238
Alper Akca
  • 41
  • 6

1 Answers1

1

Looking at the docs, set the console field in launch.json to externalTerminal.

Then, to choose the specific external terminal program to use on windows, use the terminal.external.windowsExec setting. Ex.

"terminal.external.windowsExec": "C:\\Windows\\System32\\cmd.exe"

Just replace the cmd.exe path with whatever path your Windows Terminal is installed at. Try "C:\\Users\\{user-name}\\AppData\\Local\\Microsoft\\WindowsApps\\wt.exe" or "%LocalAppData%\\Microsoft\\WindowsApps\\wt.exe".


If neither of those work, you could try set Windows Terminal to be the default terminal used on your system, which according to this Microsoft devblog, you can do in three ways:

  • In Windows Settings > Privacy and Security > For developers > Terminal > Choose the default terminal app to hose the user interface for command-line applications > Windows Terminal

  • In Windows Terminal > Settings > Default Terminal Application > Windows Terminal

  • In Powershell Properties > Terminal > Default Terminal Application > Windows Terminal

That devblog is for Windows 11.This page on tenforums.com suggests that the properties page and Windows Terminal settings approach should work starting at Windows 10 build 21390 with Windows Terminal Preview v1.9.1445.0 or higher.

starball
  • 20,030
  • 7
  • 43
  • 238
  • I'm using Windows 10 and It doesn't have Privacy and Security option In settings. In my Windows Terminal I can't see Default Terminal Application option. Does what you said only apply to Windows 11? – Alper Akca Feb 03 '23 at 20:24
  • @AlperAkca I've updated my answer after I learned something new. – starball Feb 06 '23 at 23:42
  • I did the first things you said. But now the **command prompt** for debugging opens. – Alper Akca Feb 07 '23 at 13:19
  • @AlperAkca Did you replace the cmd path in the code block with the path to your windows terminal installation? – starball Feb 07 '23 at 16:45
  • Yeah, I did. I changed cmd path with `"%LocalAppData%\\Microsoft\\WindowsApps\\wt.exe"`. – Alper Akca Feb 07 '23 at 18:16
  • Try it with the version where you don't use `%`: `"C:\\Users\\AlperAkca\\AppData\\Local\\Microsoft\\WindowsApps\\wt.exe"` or whatever it is for you with your username on your computer. – starball Feb 07 '23 at 18:18
  • Same thing happend. @user – Alper Akca Feb 08 '23 at 11:40