External Program Execution Fails Because rars are "being used by another process" #13137

Open
opened 2026-02-21 23:35:59 -05:00 by deekerman · 2 comments
Owner

Originally created by @jklassen on GitHub (Mar 1, 2022).

qBittorrent & operating system versions

qBittorrent: 4.4.1 (x64)
Windows 10 (10.0.1xxxx)

What is the problem?

I have a batch file that runs after a download is complete via the "Run external program on torrent completion"
but it fails with the following error (Changed the folder/file names):

Here is the batch file
"C:\Program Files\7-Zip\7z.exe" e "%1\*.rar" -o"%1\" >> "%SYSTEMDRIVE%\7z-logs.txt" 2>> %SYSTEMDRIVE%\7z-errors.txt

Here is 7z-logs.txt:

START [2022-02-28/23:36:40.70] 

7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21

Scanning the drive for archives:
1 file, 150000000 bytes (144 MiB)

Extracting archive: F:\theFolder\theFile.rar

Can't open as archive: 1
Files: 0
Size:       0
Compressed: 0
END [2022-02-28/23:36:40.74] 

and here is 7z-errors.txt:

ERROR: F:\thefolder\thefile.rar
Can not open the file as archive

The process cannot access the file because it is being used by another process.

Seems to me like there needs to be some kind of delay before this script is run.

MORE CONTEXT: I do not have any automatic file management in qbittorrent enabled.

Steps to reproduce

Running the batch works standalone. Fails when using the run after complete command in QBittorrent

Additional context

No response

Log(s) & preferences file(s)

No response

Originally created by @jklassen on GitHub (Mar 1, 2022). ### qBittorrent & operating system versions qBittorrent: 4.4.1 (x64) Windows 10 (10.0.1xxxx) ### What is the problem? I have a batch file that runs after a download is complete via the "Run external program on torrent completion" but it fails with the following error (Changed the folder/file names): Here is the batch file `"C:\Program Files\7-Zip\7z.exe" e "%1\*.rar" -o"%1\" >> "%SYSTEMDRIVE%\7z-logs.txt" 2>> %SYSTEMDRIVE%\7z-errors.txt` Here is 7z-logs.txt: ``` START [2022-02-28/23:36:40.70] 7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21 Scanning the drive for archives: 1 file, 150000000 bytes (144 MiB) Extracting archive: F:\theFolder\theFile.rar Can't open as archive: 1 Files: 0 Size: 0 Compressed: 0 END [2022-02-28/23:36:40.74] ``` and here is 7z-errors.txt: ``` ERROR: F:\thefolder\thefile.rar Can not open the file as archive The process cannot access the file because it is being used by another process. ``` Seems to me like there needs to be some kind of delay before this script is run. MORE CONTEXT: I do not have any automatic file management in qbittorrent enabled. ### Steps to reproduce Running the batch works standalone. Fails when using the run after complete command in QBittorrent ### Additional context _No response_ ### Log(s) & preferences file(s) _No response_
Author
Owner

@jklassen commented on GitHub (Mar 1, 2022):

I added a ping localhost -n 5 in the batch file just before the line that executes 7zip and that fixed the file usage conflict. It's weird I need to do this but whatever, its not much of a workaround.

  • For anyone who isn't familiar with command language this is just an arbitrary line that's soul purpose is to delay the script. In this case it pings itself 5 times.
@jklassen commented on GitHub (Mar 1, 2022): I added a `ping localhost -n 5` in the batch file just before the line that executes 7zip and that fixed the file usage conflict. It's weird I need to do this but whatever, its not much of a workaround. * For anyone who isn't familiar with command language this is just an arbitrary line that's soul purpose is to delay the script. In this case it pings itself 5 times.
Author
Owner

@luzpaz commented on GitHub (Jun 11, 2023):

Related to #10206

@luzpaz commented on GitHub (Jun 11, 2023): Related to #10206
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/qBittorrent#13137
No description provided.