How to show drupal error messages in batch scripts?
You should really be using Drush.  It handles bootstrapping and reporting error messages, etc.  In particular, the command drush php-script will be useful to you.

$ cd /path/to/drupal/sites/mysite
$ drush php-script /path/myscript.php


Write your script as usual.  Drush will bootstrap for you, so you may simply start calling Drupal APIs.  Any error messages generated will be printed to stderr.  See the readme file, http://drush.org, and  drush topic for all sorts of advice on getting started.