Thanks, Rex.
I introduced the batch file in trying to simplify the example, but ended up obfuscating it. My actual example has
%myp%\emacs-23.3\bin\emacsclientw.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 %10 &
as the line causing the unexpanded %myp%, with a call to an executable.
At the moment I'm...