4.25 passing flag from command line to pdflatex and htlatex?

for htlatex

htlatex main.tex "" "" ""  "\def\flag{}"
 

for pdflatex

pdflatex "\def\flag{}\input{main.tex}"
 

and now inside main.tex write

\documentclass{article} 
\begin{document} 
\ifdefined\flag 
  yes 
\else 
 no 
\fi 
\end{document}