As an extension to file ended while scanning use of \path, I tried using path with \iftoggle from etoolbox package.
Below is the error I get
File ended while scanning use of \etb@tgl@BuildC.
Here is MWE:
\documentclass[oneside, a4paper, onecolumn]{memoir}
\usepackage{url}
\usepackage{etoolbox, xcolor}
\let\path\relax \DeclareUrlCommand\path{\color{black!70}\urlstyle{tt}}
\newtoggle{BuildC}
\settoggle{BuildC}{true}
\begin{document}
\iftoggle{BuildC}%
{%
\begin{enumerate}
\item ABC
\begin{itemize}
\item Copy to \path{C:\Applications\}
\end{itemize}
\end{enumerate}
}%
{
\begin{itemize}
\item DEF
\begin{enumerate}
\item Copy to \path{~/Applications/}
\end{enumerate}
\end{itemize}
}
\end{document}
This happens only when I use \path within \iftoggle. The document compiles without errors if I remove \path.
EDIT:
Sorry about this edit. It changes things a lot. The MWE and the error has been updated to include file paths. This edit also prevents this question from being a duplicate.
\iftogglebut rather your use of\colorin the new definition of\url. You have not loaded any packages that provide color. Addingxcolorand your MWE compiles for me. – daleif Aug 08 '17 at 12:59coloraccess in order to use\color! The main issue here is that\pathseems to be interpreting\}in the ABC part. Removing the trailing\or using\ }and it compiles fine. – daleif Aug 08 '17 at 13:42