Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I would like to open vscode in the cwd and exit the Windows cmd terminal from which the command is issued at the same time .

code . (with a . for cwd) launches vscode in the cwd. exit closes the terminal. But as issuing the first command makes the terminal loses focus, I need to give it back to it to issue the second command.

I would like to type a single line command that does both actions at once, thus without the terminal losing its focus.

code . & exit doesn't work as the terminal window remains open and hangs infinitely with a flashing cursor. Ctrl-C doesn't bring the cmd prompt back and clicking the upper right x is the only way to close the terminal window when in that state. (vscode opens correctly in the cwd thought.)

How to do so?

There is no script. I just want to open vscode in the cwd of my Windows cmd terminal and close that terminal at the same time. code . is to launch vscode in the cwd, exit is to close the terminal. I would like to combine both commands (not having to close the cmd terminal manually once vscode is open). sebi Aug 7, 2021 at 10:28 Again: I want to enter those commands in a Windows command terminal after the command prompt. I don't know what to explain more... Thank you! I will wait for someone else that can understand me for his assistance. sebi Aug 7, 2021 at 14:05 Sorry but I tried to stay as polite as possible with K J . But on his deleted comments you could read he suggested I was not making myself understandable. After reformulating my issue, I didn't know what to do more besides hoping for assistance from someone else. sebi Aug 7, 2021 at 18:09

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question . Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers .