how to escape pipe symbol | in bat scripts?

Use a caret.

eg.

echo %0 on^|off