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.
-
1Does a log also appear in CLI? If so superuser.com/questions/1850112/…Destroy666– Destroy6662025年05月27日 11:50:00 +00:00Commented 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?Raghavan Vidhyasagar– Raghavan Vidhyasagar2025年05月27日 21:17:41 +00:00Commented May 27 at 21:17
2 Answers 2
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
You can also just do code . &
-
8
&doesn't work like you thought in Windowsphuclv– phuclv2025年05月28日 02:25:32 +00:00Commented 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)Alan Birtles– Alan Birtles2025年05月28日 17:42:39 +00:00Commented May 28 at 17:42
You must log in to answer this question.
Explore related questions
See similar questions with these tags.