Passing Parameters to Blender to Make It Run Python Script

I am new to Blender and Python and was trying to follow a tutorial in the book Blender 2.49 Scripting by Michel Anders. In the book, it talks about passing parameters to Blender to make it run a python script. It gives this code as an example:

blender -P /full/path/to/

Where am I supposed to be typing this?


I think it may depend on the OS. I am only WINDOWS user so for WINDOWS-es you should type this in START-button, RUN-box… At my WINDOWS though (XP Pro here) only “blender …” had not been processed so you may need to use the full path to blender.exe as well. I.e. such as “C:\Program Files\Blender Foundation\Blender\blender.exe”… unless you have a pre-defined OS golbal variable called blender with that value :spin:


Alternatively, if using windows, make a new shortcut and put the arguments outside of the quotation marks in properties (the location)

Alright I am using vista. So do I go to start and type cmd in the start search to bring up the command window and type it in there? And What is the full thing that I am typing? Is it

C:\Program Files\Blender Foundation\Blender\blender.exe -P C:\Users\Owner\Downloads\\0400_code\Chapter02\

if the file is located in the Chater02 folder?

That looks just about right. If it doesnt’ work, try extracting it from the zip file it’s in. Through if it gets stuck at “No directory C:\Program”, you might be better off just modifying the shortcut

I tryed this. (=print(“PKHG was here”) )
in the dir where I have blender.exe
blender.exe -P
worked , in the console I saw: PKHG was here

Now zipping it to I did not succeed …
Meaning probably: first unzip likes to be necessary ???

Alright finally got! I REALLY appreciate all the help. Thanks

This is what I ended up doing. First I navigated to the file that held my blender file and python file. So I pressed “cd…” twice to back out of C:\Users\Owner to just C:. Then I typed in the path to the files after "cd ", which for me was C:\Users\Owner\Downloads\0400_Code\0400_code\Chapter02. Then I typed in this

C:\Users\Owner\Downloads\0400_Code\0400_code\Chapter02>"C:\Program Files\Blender Foundation\Blender\blender.exe" -b barchart.blend -P

The quotes were needed because otherwise it got hung up on the spaces in Program Files and Blender Foundation.