The following MWE works fine:
\documentclass{article}
\usepackage{url}
\renewcommand{\path}[1]{hidden for privacy}
\begin{document}
\path{C:\User\John Doe}
\end{document}
With a trailing backslash (\path{C:\User\John Doe\}) it won't compile. I've got
Runaway argument?
{C:\User \John Doe\} \end {document}
! File ended while scanning use of \path.
How can I redefine \path that it works with trailing backslashes, too?
\}as a control sequence, so it does not recognize it as closing bracket for the argument of \path. If you use a space after the trailing backslash it should work. – Lupino Nov 05 '20 at 11:03\path, use:\DeclareUrlCommand– DG' Nov 05 '20 at 11:08\}in the example as well, such that people who naïvely tests the example sees that the example works just fine. – daleif Nov 05 '20 at 11:33\path{}) the existing document should not be touched but with some redefinitions the private data should be replaced – Micha Nov 05 '20 at 11:34\pathlike macro, that just ignores the argument, but the bracing rules should be the same as the original\path– daleif Nov 05 '20 at 11:34xparseand thevspecifier can do this, see my answer – daleif Nov 05 '20 at 11:38