@ECHO OFF IF (%1)==() GOTO HOWTO SET SAMEDIR=%~dp1 cd %SAMEDIR% SET TEX=%1 SET EXT=%~x1 SET NEX=%~n1 SET DVI=%NEX%.dvi SET PS=%NEX%.ps START /wait latex %TEX% :: Process Bibtex aux file, no extension as it is :: added automatically! START /wait bibtex %NEX% :: Run again to guarantee cites/refs files. START /wait latex %TEX% START /wait latex %TEX% :: Preview mode detection. SHIFT IF "%1" == "prev" GOTO PREV :: Finish the job and make PDF. START /wait dvips %DVI% START /wait ps2pdf %PS% ECHO Conversion complete! PAUSE GOTO END :PREV START yap %DVI% GOTO END :HOWTO ECHO How to use: ECHO 1) Install MiKTeX. ECHO 2) Check global paths are registered (to test, type "Latex" at the ECHO command-line). ECHO 3) Give the path to the file you want converted on the command-line ECHO or drag/drop it on to this batch file. ECHO 4) CTRL+C at any stage to abort. ECHO -/- ECHO http://plasmid.co.uk PAUSE :END