tags:

views:

31

answers:

1

Hi, does anyone know how to run something like the following on a Windows machine with the DOS command line?

emacs -batch -l functions.el --eval '(run-function "argument")'

Thanks!

+2  A: 

This mostly works with official binaries for 23.1, but there are some quirks with command-line argument parsing. Unlike sh or friends, CMD.EXE doesn't do much in the way of command-line parsing, so this is left to the application on windows.

Emacs.exe doesn't like single quotes:

C:\emacs-23.1\bin>emacs -batch --eval '(message "Foo!")'
End of file during parsing

Unsurprisingly, it doesn't like quotes embedded in the command either:

C:\emacs-23.1\bin>.\emacs -batch --eval "(message "Foo!")"
Symbol's value as variable is void: Foo!

Fortunately escaping with '\' seems to work OK:

C:\emacs-23.1\bin>.\emacs -batch --eval "(message \"Foo!\")"
Foo!

Hope this helps!

spong
Thanks! Can't wait to try (I only have access to this machine at certain times a day which is why I want to leave an emacs-lisp code running in batch mode...)
Stephen