View Full Version : Command Line Guidance - Please !!!

05.10.2016, 10:18 AM
Hey guys, tks for accepting me on the forum.
I am a beginner on Irfanview and command lines so I really appreciate your guidance.
I need to create a small process for editing pics in a .bat file.
The file is working fine when I write the name of the file. What I need is to drag and drop a folder with multiples images and then do some editing, exactly how it is on the command below. Can you help me with that?

"C:\Program Files (x86)\IrfanView\i_view32.exe" "C:\Users\Fernando Costa\Desktop\in\PathA\pic1.jpg" /gamma=1.60 /advancedbatch="C:\Users\Fernando Costa\Desktop\resize and canvas.ini" /convert="C:\Users\Fernando Costa\Desktop\in\PathB\pic01canvas.jpg"

move "C:\Users\Fernando Costa\Desktop\in\PathA\*.*" "C:\Users\Fernando Costa\Desktop\in\PathC"

move "C:\Users\Fernando Costa\Desktop\in\PathB\*.*" "C:\Users\Fernando Costa\Desktop\in\PathA"

move PathA "C:\Users\Fernando Costa\Desktop\in\PatchD"

06.10.2016, 07:03 PM
First I have to say that you are really in the wrong part of the forum. We have a "Command Line and Scripts" section further down the Forum that can be used so that those members who have no idea what we are talking about need not be bothered by it.

"Wishes and questions" is the part of that section best suited to your request. In there you will find my "Where to find help" thread which was intended to be a final contribution on batch files after I had decided to use Visual Basic scripts exclusively four years ago. Even that decision may now seem rather dated as Microsoft pushes Powershell further to the front. Take a look at this link (http://windowsitpro.com/powershell/break-your-batch-habit-and-move-powershell).

If no one else comes forward I will help you with the Irfanview command syntax but I am reluctant to engage in depth with batch scripts any more. There are others who read this forum who are still committed to them however.

In my "Where to find help" take a look at "Using batch parameters". It may have some of the answers you need or it might frighten you.

Bhikkhu Pesala
07.10.2016, 10:04 AM
Thread moved. Duplicate thread deleted.

16.10.2016, 11:38 PM
OK as promised I will help you to get the Irfanview command right. This is what you had in your batch file

"C:\Program Files (x86)\IrfanView\i_view32.exe" "C:\Users\Fernando Costa\Desktop\in\PathA\pic1.jpg" /gamma=1.60 /advancedbatch="C:\Users\Fernando Costa\Desktop\resize and canvas.ini" /convert="C:\Users\Fernando Costa\Desktop\in\PathB\pic01canvas.jpg"

This is what you would enter to process all the jpeg files in the PathA folder and save the result in the PathB folder with the original file names

"C:\Program Files (x86)\IrfanView\i_view32.exe" "C:\Users\Fernando Costa\Desktop\in\PathA\*.jpg" /gamma=1.60 /advancedbatch="C:\Users\Fernando Costa\Desktop\resize and canvas.ini" /convert="C:\Users\Fernando Costa\Desktop\in\PathB\*.jpg"
This will try to process all the files in PathA of any type and save them in PathB as a jpeg file with a name as in your batch file

"C:\Program Files (x86)\IrfanView\i_view32.exe" "C:\Users\Fernando Costa\Desktop\in\PathA\*.*" /gamma=1.60 /advancedbatch="C:\Users\Fernando Costa\Desktop\resize and canvas.ini" /convert="C:\Users\Fernando Costa\Desktop\in\PathB\pic##canvas.jpg"
Note though that if there are any files in PathA that Irfanview cannot open, an error message will appear and the process will stop until you OK it.

Next you asked to be able to drag and drop a folder onto the batch file icon to process the files that are in it. This is where we get to meet the batch file "quote marks" nightmare. In theory all you have to do is type %1 in your script wherever you want the folder name to appear but you sometimes have to use %~1 instead so that it can accept folders with spaces in the names. This is what usually works

"C:\Program Files (x86)\IrfanView\i_view32.exe" "%~1\*.jpg" /gamma=1.60 /advancedbatch="C:\Users\Fernando Costa\Desktop\resize and canvas.ini" /convert="C:\Users\Fernando Costa\Desktop\in\PathB\pic##canvas.jpg"

I hope that is enough to get started at least.

27.01.2018, 07:27 AM
A dropped file is a %i option in your command line, if file is in a long name folder area use space "%i" i stands for input. Also serves to name the location of the file path upon run of the batch file. Your using words like Path A, Path B, Path C and in doing that your environment would have to define those words in each separate Path.