@echo off :: Get the plot file name and location from the command line. set infile=%1 :: Change the .plt (Change to .ps if you are using that extension) to .pdf for the output. set outfile=%infile:.plt=.pdf% :: Delete any pdf files that exist with the same name if exist %outfile% del %outfile% :: Change to the directory where Ghostscript is installed c: cd \ptc\gs5.50 call ps2pdf %infile% %outfile% :: The following line should point to the destination of your pdf file c: cd c:\ :: Delete the original plot file. del %infile%