In the TeX FAQ there's a way to test if the jobname is equal to something (comparing the jobname). The difficulty of the naïve test is that the contents of the \jobname primitive are catcode 12 so to test if the \jobname is, say, myfile we need to create a macro containing the string myfile but with catcode 12 and use that to compare against \jobname.
This is all very well if you control the test. But what if you don't? What if there's some test deep in some package that you want to pass the \jobname (or some part of it) to and this test is against a predefined word of catcodes 11.
Is there some way, like \meaning, that can convert its contents to catcode 11?
Added in edit: An example of possible use has been called for.
\documentclass{beamer}
%\url{http://tex.stackexchange.com/q/117892/86}
\expandafter\includeonlylecture\expandafter{\jobname}
\begin{document}
\lecture{An Astonishing Result}{euclid}
\begin{frame}{Euclid's Astonishing Result}
\end{frame}
\lecture{A Boring Result}{pythagoras}
\begin{frame}{Pythagoras' Boring Result}
\end{frame}
\end{document}
The intention being that:
pdflatex -jobname euclide lectures.tex
and
pdflatex -jobname pythagoras lectures.tex
produce different lectures.

\scantokenscould be used or each character could be replaced by its letter counterpart. But the trouble with special characters (underscore,@, ...) remains. It is much more efficient and robuster to convert the other string to catcode 12 characters before the comparison. – Heiko Oberdiek Jun 06 '13 at 10:15\jobname(or an extracted part of it) consists only of letters. Heiko: Granted, but consider this more of a "If I really have to do this, what do I do?". – Andrew Stacey Jun 06 '13 at 10:21beamerto allow for string-based comparisons here :-) – Joseph Wright Jun 06 '13 at 15:10\jobnameas the lecture name. However, as I see now, that is similarly fraught with difficulties! – Andrew Stacey Jun 06 '13 at 15:14beamer's maintainers. – egreg Jun 06 '13 at 15:34jobnamefor conditional typesetting is just wrong. Doesn't any of the LaTeX wrapper provide something similar to ConTeXt's ability of setting modes from command line? – Aditya Jun 06 '13 at 17:59