July 12, 201214 yr Hey there!A question from me as a newbie in batch-programming :I would like to program a batch-file which executes epstopdf.exe for every *.eps in the folder, where the batch-file is located.A friend told me to use the following command-line interface (which does work pretty well, but is sometimes quite cumbersome):for %i in (*.eps) do epstopdf %iI'm sure someone can help me Thanks in advance!
July 12, 201214 yr A friend told me to use the following command-line interface (which does work pretty well, but is sometimes quite cumbersome):for %i in (*.eps) do epstopdf %iI'm sure someone can help me Yep, at it's vey basic you need to:make sure that the "right directory" is chosenmake sure that the epstopdf.exe program is foundtranslate that one-liner in a batch (basically doubling the % in the FOR loop variableBasically:@ECHO OFFCD /D %~dp0SET Program="C:\My program directory\eps to pdf\epstopdf.exe"for %%A in (*.eps) do %Program% %%Athis assumes that you copy the small batch to the directory and that you have the program in a "fixed" directory, in the example "C:\My program directory\eps to pdf\epstopdf.exe".The %~dp0 will expand to the drive and path of the item 0 of the command line (the batch file itself).jaclaz Edited July 12, 201214 yr by jaclaz
July 12, 201214 yr Author @jaclaz: Amazing how fast you have given me this answer! Thank you very much for the great explanation.I'll try it immediately!cirrocumulus
July 12, 201214 yr @ECHO OFFCD /D %~dp0SET Program="C:\My program directory\eps to pdf\epstopdf.exe"for %%A in (*.eps) do %Program% %%Athis assumes that you copy the small batch to the directory and that you have the program in a "fixed" directory, in the example "C:\My program directory\eps to pdf\epstopdf.exe".The %~dp0 will expand to the drive and path of the item 0 of the command line (the batch file itself).Since there always is room for improvement, let me please suggest one:@ECHO OFFPUSHD %~dp0SET Program="C:\My program directory\eps to pdf\epstopdf.exe"for %%A in (*.eps) do %Program% %%APOPDThe pair PUSHD/POPD saves the current drive:\directory, before changing to the new one, then returns to it, respectively.So, at the end, you'll be back to the folder you started in.
July 13, 201214 yr This is a VBS Script that will find EPS files anywhere on the Computer that this scriptrun from. Fill in the App = Chr(34) & "PATH_TO_APPLICATION_HERE" & Chr(34) with the correct path to the app. The Chr(34) = ", so the app path will be in double quotes Dim Act :Set Act = CreateObject("Wscript.Shell") Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject") Dim Wmi :Set Wmi = GetObject("winmgmts:\\.\root\cimv2") Dim App, Col, ObjApp = Chr(34) & "PATH_TO_APPLICATION_HERE" & Chr(34) Set Col = Wmi.ExecQuery _ ("Select * from CIM_DataFile Where Extension = 'eps'")'-> If No File Is Found If Col.count = 0 Then Act.Popup "Can Not Find This File Type : eps",5,"No File Found",4128 Else For Each Obj In Col '-> Run Only If App Exists If Fso.FileExists(App) Then Act.Run(App & Obj.Name),1,True Next End If
July 13, 201214 yr Author @dencorso & gunsmokingman:Thanks for the additional informations!I see, I'll have to learn a bit vbs- and batch-programming. Sometimes it seems to be really useful
Create an account or sign in to comment