background render in windows

Start a render in the background so you can keep working.
Windows path and image viewer used in this code.
This script assumes stuff, one of them being you have a full python install and another that you use irfanview to view images.


# BACKGROUND RENDER #
# Creative Commons 2.5 by J.Kassenaar
#
# ### GATHER DATA ### #

import Blender, os
from Blender import *

# ### GATHER DATA ### #

scenename = Blender.Scene.GetCurrent().getName()
frame= Blender.Get("curframe")


# ### SAVE THIS FILE ### #

Blender.Save("c:\	emp\	mpfile.blend",1)


# ### CREATE A PY FILE ### #

outp = open("c:\	emp\\background.py","w")

outp.write( "import Blender
")
outp.write( "from Blender import * 
")
outp.write( "from Blender.Scene import Render 
")

outp.write( "scn = Blender.Scene.Get(\"%s\")
" % scenename )
outp.write( "context = scn.getRenderingContext()
" )
outp.write( "context.extensions = True
" )
outp.write( "context.renderPath = \"c:\\\	emp/file\"
" )
outp.write( "context.imageType = Render.TARGA
" )
outp.write( "context.fps = 25
" )
outp.write( "context.sFrame = %d
" % frame  )
outp.write( "context.eFrame = %d
" % frame )
outp.write( "context.renderAnim()
" )

outp.close()


# ### CREATE A BATCH ### #

outp = open("c:\	emp\\background.cmd","w")

outp.write( "PATH= c:\\program files\\Blender Foundation\\Blender
")
outp.write( "PATH= %PATH%;c:\\program files\\IrfanView
")
outp.write( "cd c:\	emp
")
outp.write( "c:
")
outp.write( "blender -b tmpfile.blend -P background.py
")
outp.write( "del c:\	emp\	emp.tga
")
outp.write( "rename c:\	emp\\file%04d.tga temp.tga
" % frame )
outp.write( "i_view32 c:\	emp\	emp.tga
")

outp.close()


# ### START THE CMD ### #
# You need the full python install for this

os.spawnl (os.P_NOWAIT, "c:\	emp\\background.cmd")

use rightmouse save as to download background_render.py