#WindowsTerminal – Open Windows Terminal from the current edit file path in Visual Studio Code @code

Buy Me A Coffee

Hi !

I’m a big fan of Windows Terminal, and is my default external terminal in Visual Studio Code. However, today I learned a very cool tip:

Launch an external Windows Terminal from Visual Studio Code, and the terminal will open using the path of the current Workspace in VSCode.

Fabian explains the full scenario (see references), however the magic is to add the “startingDirectory = %__CD__%” in the profile definition in Windows Terminal Settings. In example, line 14:

      // Anaconda - Drone 02 Virtual Environment
      "guid": "{A87154C9-7846-479F-88CE-2C29BE4653CC}",
      "name": "Anaconda - Drone 02 VEnv",
      "commandline": "pwsh.exe -ExecutionPolicy ByPass -NoExit -Command & 'C:\\ProgramData\\Anaconda3\\shell\\condabin\\conda-hook.ps1' ; conda activate 'C:\\ProgramData\\Anaconda3' ; conda activate drone02; cls ",
      "hidden": false,
      "fontFace": "Cascadia Code",
      "fontSize": 12,                
      "backgroundImage": "D:/OneDrive/Pictures/WindowsTerminalBackgrounds/Ava_Wallpaper_Logo_Center_Thermal_Lat7270_5470.png",
      "backgroundImageOpacity" : 0.2,
      "colorScheme": "VibrantInk",
      "useAcrylic": true,
      "acrylicOpacity": 0.8,
      "startingDirectory": "%__CD__%" 

Awesome ! To open an external Terminal, press

Ctrl + Shift + C

and that’s it!

new terminal opened in the current workspace folder

Happy coding!


El Bruno

More posts in my blog ElBruno.com.

More info in https://beacons.ai/elbruno



Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: