In batch mode, emacs doesn't load installed packages, although the doc implies that it should. If you want to eval forms that require packages, you have to call (package-initialize) explicitly.
For instance, from a shell:
% emacs -batch -eval '(progn (message "%s" package-directory-list))'
Symbol's value as variable is void: package-directory-list
% emacs -batch -eval '(progn (package-initialize) (message "%s" package-directory-list))'
(c:/emacs/emacs/share/emacs/24.4/site-lisp/elpa c:/emacs/emacs/share/emacs/site-lisp/elpa)
Or, since I have the 'dash' package installed in my ~/.emacs.d/elpa:
% emacs -batch -eval "(progn (require 'dash))"
Cannot open load file: no such file or directory, dash
% emacs -batch -eval "(progn (package-initialize) (require 'dash))"
%
The documentation at
is not totally clear on this, but it implies that packages should be loaded.
In GNU Emacs 24.4.1 (i686-pc-mingw32)
of 2014-10-24 on LEG570
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
`configure --prefix=/c/usr'
Important settings:
value of $LANG: ENU
locale-coding-system: cp1252
Major mode: Apropos
--
Gary