Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

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.

share|improve this answer
    
Great, thanks... – UpTheCreek May 10 '11 at 18:15

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()
share|improve this answer
    
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

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

share|improve this answer
    
Another answer (from nearly 5 years ago) already suggests starting a process with lower priority. – David Makogon Apr 19 at 5: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. Rhino Apr 19 at 21:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.