Q:

How to get a batch file's cmd window to close after it's done its job?

I'm sorry to repeat-post but I've tried most solutions I've seen on here and none have worked. Currently the way I use VS Code is by a batch file that navigates to the directory I like to work out of and then runs a command to launch it. The original file looked like this:
@echo off
d:
cd c++
code .
pause

Once VS Code launches though, the cmd prompt lingers. I assumed first it was my use of pause, so I swapped that to exit. No dice. So I took to here, saw someone suggested I append start to the code . line. Still, nothing worked. At this point, I saw another post saying that it could be getting "stuck" so I decided to throw echo at each point to see if that were the case, wondering where it'd stop. At this point, the file looks like:
@echo on
d:
echo hello1
cd c++
echo hello2
start code .
echo hello3
exit

Not only did this still not close the cmd terminal, but it also isn't echoing anything at all? I'm sure it's something small but I'm just too new to this to see. Thank you for your help.

A:

You could use a taskkill command to close the command window.
The first parameter of the start command is the title of the window to create. 
You could specify a unique string there and call for taskkill with /FI parameter.
start "vs_run_unique_title" code "d:\some_code_path"
taskkill /FI "WindowTitle eq vs_run_unique_title" /F /T

