7

Until recently, I could launch Visual Studio Code from the terminal using:

code .

and the terminal would return to the prompt immediately. I could close the terminal, and VSCode would stay open without any issues.

But now, when I run the same command, the terminal seems to stay "attached" to the VSCode process. If I close the terminal window, VSCode also closes immediately.

This wasn't the behavior before. I haven't knowingly changed any system settings. My OS and VSCode might have updated recently.

I'm on windows 11 with latest VSCode installed.

asked May 27 at 11:04
2
  • 1
    Does a log also appear in CLI? If so superuser.com/questions/1850112/… Commented May 27 at 11:50
  • @Destroy666 oh yes thats the exact issue I have I can see logs. But before it used to work fine. Idk what's changed? Commented May 27 at 21:17

2 Answers 2

9

I finally fixed it by removing %LOCALAPPDATA%\Programs\Microsoft VS Code from environmental path and added %LOCALAPPDATA%\Programs\Microsoft VS Code\bin to my path.

The thing is you shouldn't use code.exe instead use code.cmd. If you followed the above step then just run code or code . it will work fine. Thanks to @Destroy666 for pointing out another post

answered May 27 at 21:25
-1

You can also just do code . &

answered May 27 at 21:58
2
  • 8
    & doesn't work like you thought in Windows Commented May 28 at 2:25
  • start code . would be the way to do this (but fixing the environment variables so this isn't necessary is the better solution) Commented May 28 at 17:42

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.