Is there a way to set out many CPU Cores a game uses without needed to reboot the PC?
Solution 1:
Newer versions of Windows let you set a program's Processor Affinity in two ways:
- When the program is running, you can adjust its Processor Affinity by opening the Task Manager (right-click the Task Bar and choose Task Manager), going to the
Details
tab, right-click the process you want to modify, and clickSet affinity
. From there, you can choose which core the program runs on. - You can use the
start
command to launch a program with a particular process affinity, like so:start /affinity 2 c:\path\to\game.exe
- You'll likely want to create a
.bat
or.ps1
file that you can double click to do this for you. A.bat
file would look something like this:
- You'll likely want to create a
%WINDIR%\system32\cmd.exe /C start /affinity 2 c:\path\to\game.exe
The number after /affinity
is actually a hexadecimal bitmask; that is each core has a value that's a power of two:
- 1 is core 1
- 2 is core 2
- 4 is core 3
- 8 is core 4
- 16 (hex 10) is core 5
- 32 (hex 20) is core 6
- 64 (hex 40) is core 7
- 128 (hex 80) is core 8
You can add these numbers together if you want it to be able to run on multiple cores, but don't forget to convert it to hexadecimal or it won't work as you expect.