Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When opening vscode using batch file, cmd opens and doesn't close

When trying to open vscode folder using a batch file, Visual Studio opens up with that folder, but also a cmd window pops up and does not go away if you use exit command.

@echo off
start code "C:\GitHub\TestApp\testapp"
exit 

VSCode opens up correctly, but also this window opens

cmd window

like image 870
Tadas Petraitis Avatar asked Sep 08 '26 00:09

Tadas Petraitis


1 Answers

Using VSCode 1.52.1, the only way I could start it without having a cmd window open after exiting the batch script is:

explorer.exe "%userprofile%\AppData\Local\Programs\Microsoft VS Code\Code.exe"

Note: it does not involve opening a specific local directory to work with. But maybe you can find a solution such as saving the folder as a workspace or using Ctrl+R to open recent folders. Plus, if you work only within that directory / workspace, or use it right before closing VSCode, it will be opened automatically at the next launch.

like image 126
Simon Avatar answered Sep 13 '26 03:09

Simon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!