Is it possible to set program affinity without opening the task manager in Windows 8.1 using the program shortcut? (by using a command like -setaffinity)
Is this method (changing affinity) a good way of limiting a program's CPU usage?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
You can create a batch file with
start /affinity 1 PATH_TO_EXE.exe
Just call this batch file in your shotcut. This will run it with only CPU 0. Change the affinity mask (this is the hex value) for more cores.
CPU3 CPU2 CPU1 CPU0 Bin Hex ---- ---- ---- ---- --- --- OFF OFF OFF ON = 0001 = 1 OFF OFF ON OFF = 0010 = 2 OFF OFF ON ON = 0011 = 3 OFF ON OFF OFF = 0100 = 4 OFF ON OFF ON = 0101 = 5 OFF ON ON OFF = 0110 = 6 OFF ON ON ON = 0111 = 7 ON OFF OFF OFF = 1000 = 8 ON OFF OFF ON = 1001 = 9 ON OFF ON OFF = 1010 = A ON OFF ON ON = 1011 = B ON ON OFF OFF = 1100 = C ON ON OFF ON = 1101 = D ON ON ON OFF = 1110 = E ON ON ON ON = 1111 = F
(Thanks to @Mokubai for pointing this out)
Alternatively, create a shortcut to
C:\Windows\System32\cmd.exe /c start /affinity 1 PATH_TO_EXE.exe