I can get Emacs to interpret its flags on my setup if I wrap things in two sets of quotes, like this:
C:\cygwin64\bin\run.exe bash -lic '"emacs -q"'
(All of this is in a
cmd window, by the way. And I'm assuming that
bash are not different in any way relevant to the question.)
I think what's happening here is that
run is stripping one level of quotes before it hands things off to
bash. However, I don't think you need the extra level of indirection. This also works for me:
C:\cygwin64\bin\bash.exe -lic "emacs -q"
EDIT: But of course you're using the
switch with Emacs, which means you'll want to use quotes with whatever you want evaluated. The hitch here is that the argument to eval also needs to be quoted, e.g.
C:\cygwin64\bin\run.exe bash -lic '"emacs --eval \"(foo)\""'
To quote strings inside that, you'll need to replace the outer single quotes with doubles and double- and triple-escape as necessary:
C:\cygwin64\bin\run.exe bash -lic "\"emacs --eval \\\"(message \\\\\\\"Foo\\\\\\\")\\\"\""
Of course that gets nuts pretty quickly. String literal syntax makes things a little saner by using single quotes while still allowing you to escape single quotes inside the string:
C:\cygwin64\bin\run.exe bash -lic "\"emacs --eval $'(message \\\"Foo\\\")'\""
Finally, there's the option of just encapsulating the code you want to evaluate as a function inside Emacs so you can call it without string or symbol literals. Alternatively, you could put it in a file and have Emacs load it with the