so i'm developing a project and every morning, i need to launch two different vs code…
- User
so i'm developing a project and every morning, i need to launch two different vs code project, on one project, i need to launch a .bat file in a terminal and run npm start in another terminal, and run npm run dev in the second vscode. tIs there a way to automate this ?
- Assistant
Yes, there is a way to automate this process. Here's a step-by-step guide on how to do it:
-
Create a Batch file for the first project:
Open Notepad and write the following commands:
cd "path\to\your\first\project" start cmd.exe /k "your-bat-file.bat" start cmd.exe /k "npm start"Replace
"path\to\your\first\project"with the actual path to your first project, and"your-bat-file.bat"with the name of your .bat file you want to run.Save this file with a
.batextension, for example,start-first-project.bat. -
Create a Batch file for the second project:
Again, open Notepad and write the following commands:
cd "path\to\your\second\project" start cmd.exe /k "code ." start cmd.exe /k "npm run dev"Replace
"path\to\your\second\project"with the actual path to your second project.Save this file with a
.batextension, for example,start-second-project.bat. -
Create a master Batch file to run both projects:
Open Notepad again, and write the following commands:
start "" "path\to\the\batch\files\start-first-project.bat" start "" "path\to\the\batch\files\start-second-project.bat"Replace
"path\to\the\batch\files\start-first-project.bat"and"path\to\the\batch\files\start-second-project.bat"with the actual paths to the batch files we created earlier.Save this file with a
.batextension, for example,start-projects.bat. -
Create a Windows Task Scheduler job to run the master Batch file:
- Press
Win + R, typetaskschd.mscand pressEnterto open Task Scheduler. - In the Task Scheduler, click on
Create Basic Task.... - Name the task and give it a description, then click
Next. - Set the
TriggertoDaily, and set the start time to whatever you want, then clickNext. - For the
Action, chooseStart a program, then clickNext. - Browse to your
start-projects.batfile, select it, then clickNext. - Click
Finish.
- Press
Now, every morning at the time you set, your computer will automatically start both of your projects in Visual Studio Code, run your .bat file and the npm commands you need.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.