Does anyone know of a way (specific to 7zip or general) to limit the CPU usage of 7zip while it is archiving a long list of files? OS is Windows Server 2008 R2, and 7zip is run via command line from a batch file.
Asked
Active
Viewed 1.2k times
3 Answers
11
Don't worry about the actual CPU percentage, instead you should start the process using a different priority. So from the command line you should be able to use start /low command
to start a command that only runs the system is IDLE.
![](../../users/profiles/984.webp)
Zoredache
- 128,755
- 40
- 271
- 413
2
If you are working in powershell you can do something like this:
$start = New-Object System.Diagnostics.ProcessStartInfo
$start.Arguments = "--argument1 --argument2"
$start.FileName = "C:\bin\7zip.exe"
$proc = New-Object System.Diagnostics.Process
$proc.PriorityClass = [System.Diagnostics.ProcessPriorityClass]::BelowNormal
$proc.StartInfo = $start
$proc.Start().WaitForExit()
![](../../users/profiles/30525.webp)
pehrs
- 8,749
- 29
- 46
-
Thanks. I'm not currently using powershell, but am thinking of updating the old batch files to it. – UpTheCreek May 10 '11 at 18:15
-
I tried this with ffmpeg it did not work got an error. Error:**Exception setting "PriorityClass": "No process is associated with this object." + $proc. <<<< PriorityClass = [System.Diagnostics.ProcessPriorityClass]::BelowNormal + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : PropertyAssignmentException Method invocation failed because [System.Boolean] doesn't contain a method named 'WaitForExit'.** Had to chop the error short because of character limit but that's the general idea. – justif Aug 18 '12 at 19:34
-2
I am using Process Explorer on all servers. When I just want to limit a one time execution of a process, I can choose the priority through the context menu of the process 7z.exe - see attached image. Set priority to Idle in context menu
![](../../users/profiles/350121.webp)
dr. rAI
- 131
- 3
-
Another answer (from nearly 5 years ago) already suggests starting a process with lower priority. – David Makogon Apr 19 '16 at 05:25
-
The nice thing about process explorer is that you don't have to stop and restart the process - you can reduce the priority at any time, even when the process was already running for an hour and you now realize that it's draining to much of the CPU. – dr. rAI Apr 19 '16 at 21:49