Announcement

Collapse
No announcement yet.

Why does my command not work on batch file but work when typing directly in CMD?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Why does my command not work on batch file but work when typing directly in CMD?

    Hi, I'm a first-day user of IrfanView and have a question. I have a bunch of multi-page tiff files and I want to split all of them individually.

    So I write a batch file with the command like this:

    C:\Program Files\IrfanView>i_view64.exe D:\originaldirectory\filename1.tif /extract=(D:\newdirectory,tif)
    C:\Program Files\IrfanView>i_view64.exe D:\originaldirectory\filename2.tif /extract=(D:\newdirectory,tif)

    ...and so on...

    I put the batch file on D drive, let's say in folder "batchfolder". But it can't do the job, this message shows up for each unsuccessful case (all of them were unsuccessful):

    D:\batchfolder>C:\Program Files\IrfanView D:\originaldirectory\filename1.tif /extract=(D:\newdirectory,tif) 1>i_view64.exe
    'C:\Program' is not recognized as an internal or external command, operable program or batch file.


    I guess that has something to do with the batch file location, so I bring it to C drive. But still it can't run properly, this time a different message shows up:

    C:\>C:\Program Files\IrfanView D:\originaldirectory\filename1.tif /extract=(D:\newdirectory,tif) 1>i_view64.exe
    Access is denied.


    This C:\>C:\ makes me think maybe the C:\ part on the batch file was redundant. So I take it out to make it look like this:

    Program Files\IrfanView>i_view64.exe D:\originaldirectory\filename1.tif /extract=(D:\newdirectory,tif)
    Program Files\IrfanView>i_view64.exe D:\originaldirectory\filename2.tif /extract=(D:\newdirectory,tif)


    ...

    But it doesn't work, either with the batch file on D or C drive.

    I then try to type it directly in the CMD window and it works normally, like this:

    C:\Program Files\IrfanView>i_view64.exe D:\originaldirectory\filename1.tif /extract=(D:\newdirectory,tif)

    Can you tell where my batch file goes wrong?

    Note: cross-post here: https://stackoverflow.com/questions/...-typing-direct. Hope it doesn't violate the policy.
    Last edited by NonSleeper; 01.06.2017, 08:25 AM.

    #2
    As I thought, the problem is with the space in the path name. You need to use quotes as the reply says on Stack X-Change.

    Cross-posting is fine, provided you tell us and provide a link. That way, no one is wasting their time figuring out the solution to a question that has already been answered.

    I wish everyone would do this when cross-posting.
    Before you post ... Edit your profile • IrfanView 4.62 • Windows 10 Home 19045.2486

    Irfan PaintIrfan View HelpIrfanPaint HelpRiot.dllMore SkinsFastStone CaptureUploads

    Comment


      #3
      Originally posted by Bhikkhu Pesala View Post
      As I thought, the problem is with the space in the path name. You need to use quotes as the reply says on Stack X-Change.

      Cross-posting is fine, provided you tell us and provide a link. That way, no one is wasting their time figuring out the solution to a question that has already been answered.

      I wish everyone would do this when cross-posting.
      Thanks much, that space is the problem and a loop would seems more efficient. An issue with both solutions, though, is that the original tiff files open when being split, which I don't need. Is there a way that I tell the command just to split files quietly?

      Comment

      Working...
      X