Help on setting affinity in task manager permanently

i have a few programs that use 99% or 100% of the CPU particularly a video encoding program called Handbrake.
When i encode a video with handbrake it uses 99-100% cpu.
While its encoding my PC struggles to open anything else, say like firefox (take 2-3 minutes to open normally it takes less than a second ) or even a little program called media info (which is usually instant now takes 1minute ) or Jdownloader (which takes upto 4 or 5 minutes to open, usually was taking 1-3 seconds without handbrake running ) this has been happening for the last year or so.

Now i looked at 2 youtube videos on how to adjust the amount of cpu used. And this is done by going into task manager right clicking on the handbrake exe , selecting affinity and unchecking 1 or 2 CPU boxes, which i did successfully, and after unchecking 1 cpu box it allowed me to encode HQ video and still open other windows instantly as i used to,which is exactly what i want.
But then when u close Handbrake (HB) and then open it next time u want to use it, or even after restarting PC you have to set the affinity again. I want to have it set to permanent so i dont have to go into affinity every time to disable 1 checkbox.

so in the 2 videos below it shows what to do. I would like some advice from people here as i am OK at doing most stuff , but not an expert.
Firstly is it safe to uncheck 1 or 2 ?
If so , if unchecking 2 which 2 do i uncheck ?
if just unchecking 1 which 1 is best ? ( currently i uncheck the last one )

My CPU listing in that affinity box is displaying 8 CPU’s
2 times now i have just disabled the last one only, and PC works perfectly and very fast at opening other items without delay while using HB.

First time adding links dont know if i have done it correctly ( Go easy on me )

Dont know what pc specs u may need if any , let me know.

I have

  • Intel i7-2600 cpu 3.40Ghz
  • Microsoft Windows 7 Pro (64bits)
  • Asus GTX 560 1gb Graphics card
  • Asus P8Z68-M PRO motherboard
  • G.Skill DDR3 12800 CL9D-8GBXL

The second video is a fake but to replicate what you’ve previously done manually by following the procedure in the first video, and to set it to use only the first three cores, right click on the program’s shortcut and enter C:\Windows\System32\cmd.exe /C start “” /affinity 07 “C:\Handbrake.exe”

I don’t know where you have Handbrake installed on your own PC but you’ll need to change the bit in the quotes to whatever the full path to the Handbrake executable is, on your system.

When you launch the program from the shortcut it will then run the command automatically, without you having to change it every time.


if you can just look at the image of where i should insert it thnx. and if you can answer those other question i have written on there.

You’ve got the correct box.

According to the video the “affinity 07” bit of the command should set it automatically to use cores 1, 2, & 3.

Is that not happening?

Also, which cores do you want to set it to use?

i copy and pasted the new full path ( Line #3 Below ) into the target area with the path to where it is on my pc than hit apply, ok.
the shortcut icon turns to black like in the video. then i double click it and shows the following error (see screenshot)

1 – Target Original path is directly below
“C:\Dean\Media programs 1\Handbrake\HandBrake\HandBrake.exe”

2 – this is the demo u gave
C:\Windows\System32\cmd.exe /C start “” /affinity 07 “C:\Handbrake.exe”

3 – this is mine with the full path
C:\Windows\System32\cmd.exe /C start “” /affinity 07 “C:\Dean\Media programs 1\Handbrake\HandBrake\HandBrake.exe”

Okay, I’ve looked at a few more guides online and it seems there has to be a name in the quotes so try this.

C:\Windows\System32\cmd.exe /C start “HandBrake” /affinity 07 “C:\Dean\Media programs 1\Handbrake\HandBrake\HandBrake.exe”

just tried that and still same outcome as above. exact same error.

are you able to test on your pc at all ?

i just did even more searching on the net and found this page, look at page 2 , post #22 .

It has this setting ( See below ) listed which worked perfect first go. However see at very bottom of this message what i wrote, BUT…

This users settings -
cmd.exe /c start “Sonar Platinum” /affinity E “C:\Program Files\Cakewalk\SONAR Platinum\sonarplt.exe”

Same settings but with my program path
cmd.exe /c start “HandBrake” /affinity E “C:\Dean\Media programs 1\Handbrake\HandBrake\HandBrake.exe”

after pasting it in the target box and selecting apply, it then adds *C:\Windows\system32* which u can see below.
C:\Windows\system32\cmd.exe /c start “HandBrake” /affinity E “C:\Dean\Media programs 1\Handbrake\HandBrake\HandBrake.exe”

BUT , this other user has a different core cpu selected. The letter E is what he sets and that makes it tick cpu 1,2,3 leaving all rest unticked , i dont what letter i need to disable CPU 7 only on mine.

UPDATE – i typed this 01111111 into this binary site
and it gave me a result of 7F , which now has all cores on except 7, which is perfect.

My new and working path.
C:\Windows\System32\cmd.exe /c start “HandBrake” /affinity 7F “C:\Dean\Media programs 1\Handbrake\HandBrake\HandBrake.exe”

each number 0 above represents a core i want off and each number 1 represents each core i want on, so because i have 8 cores and just want the first 7 turned on and the last core 7 turned off i did 01111111. which is read from right to left

All good now . thanks for your help and thank myself for trying LOL.

1 Like

That’s great. Glad you got it sorted.

It’s not something that I’ve ever tried before so I was feeling in the dark a bit myself.

That thing about the spaces makes sense though.

Instead of fighting with CPU affinities, is it possible to set HandBrake to just use fewer CPU threads? That would surely leave a few CPU cores available for running other tasks.

Alternatively, instead of setting a non-default affinity, perhaps you could set a lower CPU priority. To change a process priority manually, one can simply right-click the process (in the task manager), mouseover the “Priority”, and select either “Below Normal” or “Low”. According to this article I found, one can use the “start” command:

start /low "C:\Dean\Media Programs 1\Handbrake\Handbrake\Handbrake.exe"

PS: I only glanced through this article, so I might have missed something important. Also, I don’t run Windows (anymore), so I didn’t bother to test this.

1 Like

i was more after a permanent result, and thats what the result was above setting less cores helped and sorted this out perfectly, now i just open handbrake and its already set to the correct affinity cores. rather than going into set it manually every single time that got annoying . lowering prioty was not really permanate and i didnt look into this too much as the core reduction was better .