What you want to do is create an Action in Photoshop and then run the action in a Batch.
To learn how, look those terms up in the help files, or Google them. Play with it, and if you have further questions, come back here and ask them. (This will be a lot quicker and you’ll learn a lot more compared to us explaining the whole thing here.)