Set program affinity without opening the task manager in Windows 8.1
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
Related videos on Youtube
![Mokubai](https://i.stack.imgur.com/8qWKd.png?s=256&g=1)
Mokubai
I am a community elected moderator on Super User. First, please put down the chocolate-covered banana and step away from the European currency systems. You may consider how to ask a question. You might also want to use the right tools for the job, rather than pounding a nail with an old shoe or glass bottle. But above everything else, please, never use regex to parse HTML. Crawling abominations from the depths await those who venture down that path... Lastly, remember the golden rule of question migrations.
Updated on September 18, 2022Comments
-
Mokubai almost 2 years
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?
-
Mokubai over 7 yearsRelated: superuser.com/questions/309617/…
-
Mokubai over 7 yearsAlso: superuser.com/…
-
-
Mokubai over 7 yearsGiven that the "start" command CPU affinity is a bit mask (superuser.com/a/309663/19943) simply increasing the value would be problematic and produce unexpected results in many cases.