I have some options to typeset a command line option with a comment inside
\verb|-interaction=nonstopmode -recorder -s prologues=2 -s outputtemplate="%j.mps"|
Because I need in many places (in fact there are other reasons), I use a command instead:
\newcommand{\metapostOptions}{\verb|-interaction=nonstopmode -recorder -s prologues=2-s outputtemplate="%j.mps"|}
There is a reason, complicated to explain, which prevents me from just escaping the percent like so: \%; in fact the text in the command is generated.
I can define the command only if i include this in change of catcode.
\catcode`\%=12
\newcommand{\metapostOptions}{\verb|-interaction=nonstopmode -recorder -s prologues=2-s outputtemplate="%j.mps"|}
\catcode`\%=14
Still I cannot use, because then
(./test.out) (./test-1.cpt
! LaTeX Error: \verb ended by end of line.
I really don't understand what happens and cannot help myself.
Help very much appreciated.

\verbwith{which is wrong\verb{-i...but you can not use\verbin the argument of any command – David Carlisle May 20 '23 at 10:33I can define the command only if i include this in change of catcode.no that avoids the errr but verb does not work in that context, just use\texttt– David Carlisle May 20 '23 at 10:35\verbdefinnewverbspackage, you may want to consider the alternative of modifying the "generator" to output\%instead of%in the first place. There are other alternatives such as https://tex.stackexchange.com/a/626166/250119 – user202729 May 20 '23 at 10:58