Various small fixes to Unix grainw, initial implementation of Windows grainw.bat