tags:

views:

224

answers:

1

Hi, i am trying to create a DOS batch file to run:

.tex --> .dvi : latex filename.tex  
.dvi --> .ps  : dvips -o filename.ps filename 
.ps --> .pdf  : ps2pdf filename.ps

I tried:

latex %1
dvips -o %~n%1.ps %n%1
ps2pdf %~n%1.ps

assuming that ~n will give me the file name without the extension of a passed file. However, it doesn't work (apart from the first line). Does anyone know the correct version?

+2  A: 

Ok, some trial and error gave me

latex %1 
dvips -o %~n1.ps %~n1
ps2pdf %~n1.ps

which does the trick

Felix
You probably should surround the arguments in quotes in case the filenames contain spaces. (e.g. `dvips "%~n1.ps" "%~n1"``).
jamesdlin
I thought these may be useful to know:Fully qualified name: %~f1Drive: %~d1Path: %~p1File name: %~n1File extension: %~x1Short filename: %~sn1Short file extension: %~sx1Drive and directory: %~dp1File name and extension: %~nx1
Parsa