# Change a parameter in document using the cmd?

I need to be able to change the value of a parameter inside a LaTeX document without having to change it manually. I'll explain:

There is one main program that executes another smaller one. This smaller program computes some things and creates a .txt-file with a specific name and all its results inside. Then the main program executes the LaTeX file I have to create which will process the created .txt-file into a nice pdf (using commands such as \openin\txtfile=\filename.txt and the package datatool).
Problem is that LaTeX needs to know the name of the newly created .txt-file. The main program knows the name it and will call the LaTeX file by using the cmd command > latex texfile.tex. But this won't change the value of \filename in any way.

Is there actually any possible way to change a value (of \filename) inside the LaTeX file using the cmd? Because I have absolutely no clue and Google doesn't help me either...

-
You do pdflatex \def\filename{abc}\input{texfile} –  Ulrike Fischer Jul 16 '12 at 13:52
Thanks will try it :) –  Didii Jul 16 '12 at 15:17

Thanks to Ulrike Fischer for the solution:

> pdflatex \cmd\input{texfile}


\cmd can be any command LaTeX recognizes. And input{texfile} pastes all contents of texfile.tex into the cmd.

-
Potentially you might want to change the jobname
latex -jobname=$filename texfile.tex where$filename is the name of your .txt file. Then inside your .tex file you could use
\openin\txtfile=\jobname