On 28 May 2010 09:48, alux <alu...@googlemail.com> wrote:
> Hello!
>
> Short: It works, but is not perfect.
>
> (this may need an windows expert to make it better)

Try this:

--- myscript.bat ---
:x (comment
@echo off
java -cp clojure.jar clojure.main "%~f0" %*
goto eof
)

(println "Hi!" *command-line-args*)

------

The way it works:

The line starting with :x is treated as a label by cmd.exe (and so, in
effect, ignored). In Clojure, it's treated as a keyword :x followed by
the start of a multiline comment - (comment

So everything down to the closing ) is ignored by clojure, but
executed by cmd.exe

The next bits:
@echo off - suppress cmd.exe's annoying habit of displaying everything
java... Run the clojure script. %~f0 is the script name - I quote it
in case it has spaces, and %* is the rest of the command line.
Then, goto eof terminates the batch file (goto end of file), ignoring
the rest of the file, which can therefore be arbitrary clojure.

Paul.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to