I repeatedly run the same commands to set up and launch my projects, but currently I copy them from a document every time. Is there a better way to automate this in Windows Command Prompt, PowerShell, or another shell?
3 Answers
You can use Windows Terminal as the terminal application and run PowerShell inside it instead of the older Command Prompt. For larger or more complex projects, tools such as CMake may also help automate configuration and build commands.
Create a batch file with a .bat extension and put the commands in the order you want them executed. You can run that file whenever you start a project, and batch files also support variables, parameters, loops, and conditional statements.
PowerShell is generally the better modern option on Windows. You can save commands in a .ps1 script and run it whenever needed. Command Prompt is simpler, but PowerShell provides more features for handling files, processes, variables, and project setup.

That sounds useful. I’ll try building a few scripts and see how much of my setup I can automate.