\documentclass{article}

\usepackage{fancyvrb}

\begin{document}

  \catcode`\$=12

  \VerbatimInput{a.txt}

  \VerbatimInput{$.txt}

\end{document}
