Search found 3 matches

by tamle
2018-10-22T18:59:43-07:00
Forum: Users
Topic: Convert pdf if has less than 2 pages Command line
Replies: 4
Views: 3794

Re: Convert pdf if has less than 2 pages Command line


You can put "rem" inside loops, but not "::".

As you are learning the basics of BAT scripting, I suggest you find a good manual or webpage on the subject.


Your suggestion is correct. This language seems to be far stricter and precise in structure compare to the languages that I am familiar ...
by tamle
2018-10-22T18:16:06-07:00
Forum: Users
Topic: Convert pdf if has less than 2 pages Command line
Replies: 4
Views: 3794

Re: Convert pdf if has less than 2 pages Command line

The new full code is like this and it return "do was unexpected at this time."
SETLOCAL EnableDelayedExpansion
pause
set path="C:\Program Files\ImageMagick-7.0.8-Q16\";%path%

FOR /r %%g in (*.pdf) DO (
for /f %%i in ('identify -format %%n %%g') do set pgs=%%i
echo !pgs!
::convert %%~ng%%~xg ...
by tamle
2018-10-22T12:21:43-07:00
Forum: Users
Topic: Convert pdf if has less than 2 pages Command line
Replies: 4
Views: 3794

Convert pdf if has less than 2 pages Command line

I am trying to convert PDF files into jpg but only if it has 1 page. So I have run successfully both the command to identify the page and convert files. However, I could get it to work together in a bat file. I am trying to use this code. This bat file is put in a folder of many pdf, and the code ...