Search code examples
winrar

Why does WinRAR stall indefinitely after creating the archive?


Using WinRAR 4.2 64-bit to create password-protected archive files, launched via WScript.Shell Exec method using the command line:

C:/Program Files/WinRAR/rar.exe a -df -ep -pxxxx C:/mtr_app/output/local/REP025_Secondary_Aug-2016.rar C:/mtr_app/temp/47/*.*

This works fine usually but fails to finish with a particular archive comprising about 40 files (39 Excel and 1 text). The archive is created within a few seconds and then WinRAR just doesn't exit. This is repeatable, but only with this particular (large) archive. The '47' directory in the command line is a temp directory created specifically to hold the files required in the archive, so it gets a different number each time (a job id).

WinRAR is correctly licensed, but in any case its correct behaviour with other archives seems to rule out the hidden EULA window gotcha.

Any suggestions would be welcome.


Solution

  • In case it helps others: removing the -df flag (delete files) seems to have fixed the problem, which suggests that something else had not let go of at least one of the files in the temporary output directory. Given that they are Excel files and Excel's notoriety in not closing tidily, especially when automated, the culprit is easily identified.