Automate Running Blender from Command Line

I know you can run blender from the command line. What I am interested in doing is writing a program of some sort that opens up .blends, modifies them, saves them, and then closes them. I want to do this on many .blends so I am trying to automate it somehow. Is there a way to do this using the command line? I have experience writing python scripts but don’t know much else in terms of coding. I am using Windows 8. Even just a link to another webpage describing this process would be very helpful. I don’t know what to search online to find this answer.


So theres a few things you will need to do

you will need to first create a python file, which when executes does your modifications & saves the blend file.

after this is done, look into batch programming for windows… (.bat files)… use this to go over all the files you need, and run blender from commandline on each of them running the python file from each

/location/to/blender/blender.exe -b /location/to/blend/file.blend -P /location/to/python/ -y

this command will open the blender file in blender and run the python file.

@amartin7211 You could consider to create a UI interface using Java or C# (Java better because can run in Win/Unix/OSX). This UI can be as complex as you want to keep control of all. Of course, you need a python to do all the work as @doublebishop said.

Thanks for the advice. Yes the python won’t be a problem. so from what u guys are telling me I either need to write a .bat or use java or c#. Any thoughts on what would be simpler? I eventually want to learn to write a ui but have some time constraints. Would this take a while to learn or is it pretty easy?

amartin7211 It’s not easy to answer your question. Write an UI program can be easy or not depending of the UI you want. Maybe, if you work in windows, the best idea is download VS2013 ( and try, I think is easier than Java.

Gotcha. Ok well thanks so much for the help

No, no, no. no no. Java and c# suck. They’re bloated and they’re frameworks and more open to exploit, hopefully soon to be deprecated.

If you’re experimenting with python why not stick with python and use tkinter to create a gui and run a process.

Python GUI resources…