I tried to use a switch \IfFileExists
to define a command differently, but I get the illegal parameter error. I am running LaTeX from TeX Live 2021.
A minimal example is:
\documentclass[12pt,fleqn]{article}
\usepackage[dvipsnames]{xcolor}
\IfFileExists{filename}
{\newcommand{\ABC}[1]{{\begin{color}{Red}{#1}\end{color}}}}
{\newcommand{\ABC}[1]{{\begin{color}{Blue}{#1}\end{color}}}}
\begin{document}
\ABC{Why?}
\end{document}
##
not ``#