Question

I am attempting to call pdflatex.exe on a file in a powershell script thus:

    Out-File -FilePath C:\path\to\file\foo.txt -InputObject $bar -Encoding 'ASCII'
    texdoc.exe letter
    pdflatex.exe C:\path\to\file\example.tex
    latex.exe C:\path\to\file\example.tex
    pdflatex.exe 'C:\path\to\file\example.tex'
    latex.exe 'C:\path\to\file\example.tex'
    pdflatex.exe C:/path/to/file/example.tex
    latex.exe C:/path/to/file/example.tex
    pdflatex.exe 'C:/path/to/file/example.tex'
    latex.exe 'C:/path/to/file/example.tex'

The first line works, so there is no permissions problem. The second call works, so there is no problem accessing the binaries. None of the subsequent calls work. There are no pre-existing .ps, .dvi or .pdf files in the directory.

Calling from the powershell command-line works as expected with the same file (example.tex), but not from the script. Why? How can I view the error message thrown by pdflatex or latex? MikTex 2.9, Windows 7, Powershell 2.0.

Was it helpful?

Solution

Probably not the most suitable answer, but I got around this by "cd-ing" into the relavant directory by using

    Set-Location -Path C:\path\to\file\
    pdflatex example.tex
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top