Results 1 to 6 of 6

Thread: Script doesn't wait

  1. #1
    IV Newbie
    Join Date
    Jun 2016
    Posts
    3

    Default Script doesn't wait

    Hello,
    I have this script:
    Code:
    call %~dp0\IrfanViewPortable\IrfanViewPortable.exe %~dp0\pictures\*.jpg /convert="%~dp0\Output\temp\%INPUT% %HASH%.jpg"
    call %~dp0\7Zip\7z.exe a %~dp0\Output\%INPUT%.zip %~dp0\Output\temp\*
    @RD /S /Q "%~dp0\Output\temp"
    I want to rename all pictures in the folder "pictures" and copy them to "temp". After renaming 7zip should zip the renamed files. But 7zip starts zipping before irfanview ended the renaming. So just a few pictures get zipped.

    I also tried "start \wait" -> no difference.
    I added "ping 127.0.0.1 -n 2 > nul" with various times -> a few more pictures get zipped but not all

    How does the Batch wait until irfanview is ready with coping all pictures?

    Julian

  2. #2
    Moderator Enterprise User Bhikkhu Pesala's Avatar
    Join Date
    May 2007
    Location
    East London
    Posts
    6,039
    OS
    64-bit Win 10
    CPU Cores
    1

    Default

    How about using a Pause cmd and pressing any key to continue with the archiving operation?

  3. #3
    IV Newbie
    Join Date
    Jun 2016
    Posts
    3

    Default Possible

    Quote Originally Posted by Bhikkhu Pesala View Post
    How about using a Pause cmd and pressing any key to continue with the archiving operation?
    That would be a possibility. But I prefer a solution which works without human interaction. The target group of this project needs a tool which is as easy as possible.

  4. #4
    IV Newbie
    Join Date
    Jun 2016
    Posts
    3

    Default

    I tried the same program again (without Pause) and its working great... The zipping waits until irfanview finished the conversion. I'll see, if the problem occurs again.

  5. #5
    Professional User Mij's Avatar
    Join Date
    Mar 2007
    Location
    Camberley, Surrey, UK
    Posts
    2,763
    Version
    IrfanView 4.51
    OS
    32-bit Win 10
    CPU Cores
    3

    Default

    Are you sure you did exactly the same thing when you tried it the second time? We have discussed this in the past but I am unable to find the thread I was looking for because it was a long time ago.

    The issue is about whether or not the script waits for Irfanview to close before continuing. There are differences between using the command "Start" the command "Call" or no command at all at the beginning of the line where you want to launch an external program. I seem to recall that with no command the script always waits for the external program to terminate, whereas with "Start" it always continues without waiting. With "Call" I think it behaves differently in a Command Prompt window to how it does in a Batch file. I may have got this a bit mixed up though. I have not used Command Prompt scripts for some time, preferring to use Visual Basic scripts instead.

  6. #6

    Default

    I have had this problem with Windows 10. The solution was that start will not wait unless you are launching a 64 bit program. Try the 64 bit version of Irfanview.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •