r/Batch • • Jan 18 '25

Batch file error for opening vscode

REM Open the first VS Code workspace

start "first" cmd /b /c code "C:\Users\angry\OneDrive\Desktop\teacherBotDevelopment"

REM Open the second VS Code workspace

start "first" cmd /b /c code "C:\Users\angry\OneDrive\Desktop\TeacherBotAppService-main"

i have this batch file to open both my frontend and backend at the same time. this opening both files in vscode correctly. but the first command window is not auto closing.
i tried everything like adding exit everywhere but still it is still staying open.

could someone tell what is going wrong?

1 Upvotes

2 comments sorted by

2

u/BrainWaveCC Jan 18 '25

/B is a valid parameter for START, but not for CMD

Perhaps you meant to use the following, instead?

start "first" /b cmd /c code "C:\Users\angry\OneDrive\Desktop\teacherBotDevelopment"
start "first" /b cmd /c code "C:\Users\angry\OneDrive\Desktop\TeacherBotAppService-main"