Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Batch file to use list of files and perform an action for each of the files  (Read 3905 times)

0 Members and 1 Guest are viewing this topic.

bmacbmac

    Topic Starter


    Greenhorn

    Hello.  I have to run a command line to process one file at a time in Irfanview.  My command line looks like this:

    Code: [Select]
    "c:\program files (x86)\irfanview\i_view32.exe" c:\tif\430251.tif /extract=(c:\tiffsplit, tif)
    "c:\program files (x86)\irfanview\i_view32.exe" c:\tif\430252.tif /extract=(c:\tiffsplit, tif)
    "c:\program files (x86)\irfanview\i_view32.exe" c:\tif\430253.tif /extract=(c:\tiffsplit, tif)
    "c:\program files (x86)\irfanview\i_view32.exe" c:\tif\430254.tif /extract=(c:\tiffsplit, tif)
    "c:\program files (x86)\irfanview\i_view32.exe" c:\tif\430255.tif /extract=(c:\tiffsplit, tif)
    "c:\program files (x86)\irfanview\i_view32.exe" c:\tif\430256.tif /extract=(c:\tiffsplit, tif)

    I have to create this batch file in the following steps:
    1.  run:  dir /b c:\temp > list.txt       (to create a list of files)
    2.  Copy/Paste the list into Excel
    3.  Concatenate a command line for each file in Excel.
    4.  Copy concatenated lines into a batch file.

    Is there a way I can skip all of those steps and do something like:
    forfiles /p c:\temp /m *.tif  IRFANVIEWSCRIPT

    Thanks!

    Brian

    Squashman



      Specialist
    • Thanked: 134
    • Experience: Experienced
    • OS: Other
    Code: [Select]
    @echo off
    for %%G in (c:\tif\*.tif) do "c:\program files (x86)\irfanview\i_view32.exe" "%%~G" /extract=(c:\tiffsplit, tif)

    bmacbmac

      Topic Starter


      Greenhorn

      Worked great!  Thanks!