I was wondering if there was a way to set a chain of commands to run without having to type the in individually everytime you want to run it. That way, when I get an computer to secure I can just run a preset series of commands to enable password policies and such. I have all the commands I want to run already. Also is there a way to do an if/then the same way? Like if this program is found on the computer, delete it. Thanks

marked as duplicate by George Udosen, muru command-line Oct 19 '18 at 1:22

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


what you are looking for is a batch script. It allows you write your commands to a file that you can then run with the terminal.

Additionally, control elements can be used like if / else conditions or case switches.

Not the answer you're looking for? Browse other questions tagged or ask your own question.