If you look at this #!/usr/local/bin/math8.0.4/MathematicaScript -script $HistoryLength=0; $pwf=FileNameJoin[{NotebookDirectory[],FileBaseName[NotebookFileName[]]}]; $pwf = "test"; $parameterfile=StringJoin[$pwf,".dat"]; Print[$pwf]; Print[$parameterfile]; you will see that both Print statements work just fine - What requires the FrontEnd are the `Notebook*XY*[]` functions and since this is a script and not a notebook these are not avaiable. So you'd need to replace those. You could, for example use `$InputFileName` and derive the information from that instead.