Automate daily project setups.
- 21-08-2024
- programming
Share:
Copy
Working on a web / app projects requires repeated tasks to be performed each time you start your day. Things like opening your project repo into your code editor, opening terminal and starting a server like node, opening chrome or web browser with specific url and port, opening tools like postman and db viewers etc.
As you can see things pile up quickly even though it might not take a long time but performing these repeated things everyday can consume your time in long term. There must be a solution to automate these things and perform each step in a single click.
Well there the quickest way I found out was a simple Bat / Bach file. What are batch files ? Here is what copilot 🤖 has to say:
Batch files are powerful tools for automating repetitive tasks in Windows. They are essentially scripts that contain a series of commands to be executed by the command-line interpreter.
So let's see how we can use a simple Batch file to automate our daily project setup tasks.
1. Opening Chrome and VS code
Create a file with an extension .bat like "project1.bat" and write the commands as shown in the below image.
Here we have two instructions or commands 1st is to open the chrome and 2nd is to open the VS code. Save the file and just double click the file and both chrome and vs code will open.
Result
2. Connecting to server via SSH
Same as before Create a file with an extension .bat like "ssh.bat" and write the commands that you use to connect to the server via SSH like I use pem key files and ip of server for example something like below.
Save the file and just double click the file and new terminal will open which will run the SSH command.
3. Opening terminal and executing commands
For most of time your workflows includes complicated tasks like opening terminals and running commands. For this we can easily achieve it here we will use the windows power shell. Below bat file shows the command, where we are instructing to open power shell and providing folder, title and the command to run "yarn dev"
With this simple script you can achieve a lot of things and automate your daily tasks. The possibilities are endless 😎.