Processor Affinity - Add Set Affinity to Context Menu

How to Add or Remove "Run with CPU Affinity" to the Context Menu


   Information
By default, Vista, Windows 7, and Windows 8 runs an application on all available cores of the processor. If you have a multi-core processor, then this will show you how to add or remove Run with CPU Affinity from all application files and shortcuts context menu to set processor affinity to an application to control which core(s) of the processor an application will run on.

If the application and CPU supports Symmetric Multiprocessing (SMP) or HyperThreading (HT), then Windows will automatically adjust the application's usage of each processor core for the best performance. You will not gain much, if anything, from manually changing the processor affinity for these type of applications.
   Note
The affinity changes you make to the current instance of an application or process are only temporary and not set permanently.

Once you close the application or restart your system, Windows forgets your set affinity and automatically sets back the default affinity of the application running on all available cores of the processor.
   Warning
I have included REG downloads below to add context menu items for up to a 12 core processor. How many cores you actually have will depend on your processor. You can add one or more of any of the following Run with CPU Affinity context menu items below to use as needed.

DO NOT ADD A CONTEXT MENU ITEM numbered above how many cores you actually have.

You can quickly see how many processor cores you have by opening Task Manager (CTRL+SHIFT+ESC), clicking on the Performance tab, and counting how many CPU Usage History graphs you have.

Task_Manager.jpg

EXAMPLE: Run with CPU Affinity Added or Removed from Context Menu
Default.jpgAdded_exe_shortcuts.jpg
Added_Pinned_to_Start_Menu.jpgAdded_Takbar_icons.jpg



OPTION ONE

Using a REG File Download


NOTE: You can only merge these REG files while logged in as an administrator. See warning box above.

CPU-0 = Processor Core 1, CPU-1 = Processor Core 2, etc.......
1. To Add Run with CPU-0 Affinity to Context Menu
A) Click on the Download button below to download the file below.

Add_Run_with_CPU-0_Affinity_to_Context_Menu.reg

Download


2. To Remove Run with CPU-0 Affinity from Context Menu
A) Click on the Download button below to download the
file below.

Remove_Run_with_CPU-0_Affinity_from_Context_Menu.reg

Download


3. To Add Run with CPU-1 Affinity to Context Menu
A) Click on the Download button below to download the file below.

Add_Run_with_CPU-1_Affinity_to_Context_Menu.reg

Download


4. To Remove Run with CPU-1 Affinity from Context Menu
A) Click on the Download button below to download the
file below.

Remove_Run_with_CPU-1_Affinity_from_Context_Menu.reg

Download


5. To Add Run with CPU-2 Affinity to Context Menu
A) Click on the Download button below to download the file below.

Add_Run_with_CPU-2_Affinity_to_Context_Menu.reg

Download


6. To Remove Run with CPU-2 Affinity from Context Menu
A) Click on the Download button below to download the
file below.

Remove_Run_with_CPU-2_Affinity_from_Context_Menu.reg

Download


7. To Add Run with CPU-3 Affinity to Context Menu
A) Click on the Download button below to download the file below.

Add_Run_with_CPU-3_Affinity_to_Context_Menu.reg

Download


8. To Remove Run with CPU-3 Affinity from Context Menu
A) Click on the Download button below to download the
file below.

Remove_Run_with_CPU-3_Affinity_from_Context_Menu.reg

Download


9. To Add Run with CPU-4 Affinity to Context Menu
A) Click on the Download button below to download the file below.

Add_Run_with_CPU-4_Affinity_to_Context_Menu.reg

Download


10. To Remove Run with CPU-4 Affinity from Context Menu
A) Click on the Download button below to download the
file below.

Remove_Run_with_CPU-4_Affinity_from_Context_Menu.reg

Download


11. To Add Run with CPU-5 Affinity to Context Menu
A) Click on the Download button below to download the file below.

Add_Run_with_CPU-5_Affinity_to_Context_Menu.reg

Download


12. To Remove Run with CPU-5 Affinity from Context Menu
A) Click on the Download button below to download the
file below.

Remove_Run_with_CPU-5_Affinity_from_Context_Menu.reg

Download


13. To Add Run with CPU-6 Affinity to Context Menu
A) Click on the Download button below to download the file below.

Add_Run_with_CPU-6_Affinity_to_Context_Menu.reg

Download


14. To Remove Run with CPU-6 Affinity from Context Menu
A) Click on the Download button below to download the
file below.

Remove_Run_with_CPU-6_Affinity_from_Context_Menu.reg

Download


15. To Add Run with CPU-7 Affinity to Context Menu
A) Click on the Download button below to download the file below.

Add_Run_with_CPU-7_Affinity_to_Context_Menu.reg

Download


16. To Remove Run with CPU-7 Affinity from Context Menu
A) Click on the Download button below to download the
file below.

Remove_Run_with_CPU-7_Affinity_from_Context_Menu.reg

Download


17. To Add Run with CPU-8 Affinity to Context Menu
A) Click on the Download button below to download the file below.

Add_Run_with_CPU-8_Affinity_to_Context_Menu.reg

Download


18. To Remove Run with CPU-8 Affinity from Context Menu
A) Click on the Download button below to download the
file below.

Remove_Run_with_CPU-8_Affinity_from_Context_Menu.reg

Download


19. To Add Run with CPU-9 Affinity to Context Menu
A) Click on the Download button below to download the file below.

Add_Run_with_CPU-9_Affinity_to_Context_Menu.reg

Download


20. To Remove Run with CPU-9 Affinity from Context Menu
A) Click on the Download button below to download the
file below.

Remove_Run_with_CPU-9_Affinity_from_Context_Menu.reg

Download


21. To Add Run with CPU-10 Affinity to Context Menu
A) Click on the Download button below to download the file below.

Add_Run_with_CPU-10_Affinity_to_Context_Menu.reg

Download


22. To Remove Run with CPU-10 Affinity from Context Menu
A) Click on the Download button below to download the
file below.

Remove_Run_with_CPU-0_Affinity_from_Context_Menu.reg

Download


23. To Add Run with CPU-11 Affinity to Context Menu
A) Click on the Download button below to download the file below.

Add_Run_with_CPU-11_Affinity_to_Context_Menu.reg

Download


24. To Remove Run with CPU-11 Affinity from Context Menu
A) Click on the Download button below to download the
file below.

Remove_Run_with_CPU-11_Affinity_from_Context_Menu.reg

Download


25. Save the .reg file to your desktop.

26. Double click/tap on the downloaded .reg file to merge it.

27. Clic/tap on Run, Yes (UAC), Yes, and OK when prompted.

28. When finished, you can delete the downloaded .reg file(s) on the desktop if you like.



OPTION TWO

Using a BAT File Download


NOTE: You can only merge these BAT files while logged in as an administrator. See warning box above. Special thanks to Dwarf for this option.

CPU-0 = Processor Core 1, CPU-1 = Processor Core 2, etc.......
1. To Add Run with CPU-0 Affinity to Context Menu
A) Click on the Download button below to download the file below.

Add_Run_with_CPU-0_Affinity_to_Context_Menu.bat

Download


2. To Remove Run with CPU-0 Affinity from Context Menu
A) Click on the Download button below to download the
file below.

Remove_Run_with_CPU-0_Affinity_from_Context_Menu.bat

Download


3. To Add Run with CPU-1 Affinity to Context Menu
A) Click on the Download button below to download the file below.

Add_Run_with_CPU-1_Affinity_to_Context_Menu.bat

Download


4. To Remove Run with CPU-1 Affinity from Context Menu
A) Click on the Download button below to download the
file below.

Remove_Run_with_CPU-1_Affinity_from_Context_Menu.bat

Download


5. To Add Run with CPU-2 Affinity to Context Menu
A) Click on the Download button below to download the file below.

Add_Run_with_CPU-2_Affinity_to_Context_Menu.bat

Download


6. To Remove Run with CPU-2 Affinity from Context Menu
A) Click on the Download button below to download the
file below.

Remove_Run_with_CPU-2_Affinity_from_Context_Menu.bat

Download


7. To Add Run with CPU-3 Affinity to Context Menu
A) Click on the Download button below to download the file below.

Add_Run_with_CPU-3_Affinity_to_Context_Menu.bat

Download


8. To Remove Run with CPU-3 Affinity from Context Menu
A) Click on the Download button below to download the
file below.

Remove_Run_with_CPU-3_Affinity_from_Context_Menu.bat

Download


9. To Add Run with CPU-4 Affinity to Context Menu
A) Click on the Download button below to download the file below.

Add_Run_with_CPU-4_Affinity_to_Context_Menu.bat

Download


10. To Remove Run with CPU-4 Affinity from Context Menu
A) Click on the Download button below to download the
file below.

Remove_Run_with_CPU-4_Affinity_from_Context_Menu.bat

Download


11. To Add Run with CPU-5 Affinity to Context Menu
A) Click on the Download button below to download the file below.

Add_Run_with_CPU-5_Affinity_to_Context_Menu.bat

Download


12. To Remove Run with CPU-5 Affinity from Context Menu
A) Click on the Download button below to download the
file below.

Remove_Run_with_CPU-5_Affinity_from_Context_Menu.bat

Download


13. To Add Run with CPU-6 Affinity to Context Menu
A) Click on the Download button below to download the file below.

Add_Run_with_CPU-6_Affinity_to_Context_Menu.bat

Download


14. To Remove Run with CPU-6 Affinity from Context Menu
A) Click on the Download button below to download the
file below.

Remove_Run_with_CPU-6_Affinity_from_Context_Menu.bat

Download


15. To Add Run with CPU-7 Affinity to Context Menu
A) Click on the Download button below to download the file below.

Add_Run_with_CPU-7_Affinity_to_Context_Menu.bat

Download


16. To Remove Run with CPU-7 Affinity from Context Menu
A) Click on the Download button below to download the
file below.

Remove_Run_with_CPU-7_Affinity_from_Context_Menu.bat

Download


17. To Add Run with CPU-8 Affinity to Context Menu
A) Click on the Download button below to download the file below.

Add_Run_with_CPU-8_Affinity_to_Context_Menu.bat

Download


18. To Remove Run with CPU-8 Affinity from Context Menu
A) Click on the Download button below to download the
file below.

Remove_Run_with_CPU-8_Affinity_from_Context_Menu.bat

Download


19. To Add Run with CPU-9 Affinity to Context Menu
A) Click on the Download button below to download the file below.

Add_Run_with_CPU-9_Affinity_to_Context_Menu.bat

Download


20. To Remove Run with CPU-9 Affinity from Context Menu
A) Click on the Download button below to download the
file below.

Remove_Run_with_CPU-9_Affinity_from_Context_Menu.bat

Download


21. To Add Run with CPU-10 Affinity to Context Menu
A) Click on the Download button below to download the file below.

Add_Run_with_CPU-10_Affinity_to_Context_Menu.bat

Download


22. To Remove Run with CPU-10 Affinity from Context Menu
A) Click on the Download button below to download the
file below.

Remove_Run_with_CPU-0_Affinity_from_Context_Menu.bat

Download


23. To Add Run with CPU-11 Affinity to Context Menu
A) Click on the Download button below to download the file below.

Add_Run_with_CPU-11_Affinity_to_Context_Menu.bat

Download


24. To Remove Run with CPU-11 Affinity from Context Menu
A) Click on the Download button below to download the
file below.

Remove_Run_with_CPU-11_Affinity_from_Context_Menu.bat

Download


25. Save the .bat file to your desktop.

26. Right click or press and hold on the downloaded .bat file, and click on Run as administrator.

27. Click/tap on Run and Yes (UAC) when prompted.

28. When finished, you can delete the downloaded .bat file(s) on the desktop if you like.
That's it,
Shawn




 

Attachments

Last edited:
Great news. :party:
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Self built custom
OS
64-bit Windows 11 Pro for Workstations
CPU
Intel i7-8700K OC'd to 5 GHz
Motherboard
ASUS ROG Maximus XI Formula Z390
Memory
64 GB (4x16GB) G.SKILL TridentZ RGB DDR4 3600 MHz
Graphics Card(s)
ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
Sound Card
Integrated
Monitor(s) Displays
2 x Samsung Odyssey G7 27"
Screen Resolution
2560x1440
Hard Drives
1TB Samsung 990 PRO M.2,
4TB Samsung 990 PRO PRO M.2,
TerraMaster F8 SSD Plus NAS
PSU
Seasonic Prime Titanium 850W
Case
Thermaltake Core P3
Cooling
Corsair Hydro H115i
Keyboard
Logitech wireless K800
Mouse
Logitech MX Master 4
Internet Speed
2 Gb/s Download and 100 Mb/s Upload
Antivirus
Malwarebyte Anti-Malware Premium
Browser
Google Chrome
Other Info
Logitech Z625 speaker system,
Logitech BRIO 4K Pro webcam,
HP Color LaserJet Pro MFP M477fdn,
APC SMART-UPS RT 1000 XL - SURT1000XLI,
Galaxy S23 Plus phone
Hello, I have not been able until now. I'm going to put here the content of reg archive that at least to me it works. It's made for 4 cores, but it haven't all combinations, only these one:

- 4 cores (0,1,2,3)
- 3 cores (1,2,3)
- 3 cores (1,2,3)
- 2 cores (0,1)
- 2 cores (2,3)
- 1 core (0)
- 1 core (1)
- 1 core (2)
- 1 core (3)


The reg file is this one:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\exefile\shell\3 Ejecutar con afinidad]
@=""
"Icon"="%SystemRoot%\\System32\\shell32.dll,43"
"MUIVerb"="Ejecutar con afinidad de ..."
"SubCommands"=""

[HKEY_CLASSES_ROOT\exefile\shell\3 Ejecutar con afinidad\shell]

[HKEY_CLASSES_ROOT\exefile\shell\3 Ejecutar con afinidad\shell\1 Nº núcleos = 4]
@="4 núcleos (el 0, 1, 2 y 3)"

[HKEY_CLASSES_ROOT\exefile\shell\3 Ejecutar con afinidad\shell\1 Nº núcleos = 4\command]
@="cmd /c start "Afinidad CPU" /affinity 0F "%1""

[HKEY_CLASSES_ROOT\exefile\shell\3 Ejecutar con afinidad\shell\2 Nº núcleos = 3]
@="3 núcleos (el 0, 1 y 2)"

[HKEY_CLASSES_ROOT\exefile\shell\3 Ejecutar con afinidad\shell\2 Nº núcleos = 3\command]
@="cmd /c start "Afinidad CPU" /affinity 07 "%1""

[HKEY_CLASSES_ROOT\exefile\shell\3 Ejecutar con afinidad\shell\3 Nº núcleos = 3]
@="3 núcleos (el 1, 2 y 3)"

[HKEY_CLASSES_ROOT\exefile\shell\3 Ejecutar con afinidad\shell\3 Nº núcleos = 3\command]
@="cmd /c start "Afinidad CPU" /affinity 0E "%1""

[HKEY_CLASSES_ROOT\exefile\shell\3 Ejecutar con afinidad\shell\4 Nº núcleos = 2]
@="2 núcleos (el 0 y 1)"

[HKEY_CLASSES_ROOT\exefile\shell\3 Ejecutar con afinidad\shell\4 Nº núcleos = 2\command]
@="cmd /c start "Afinidad CPU" /affinity 03 "%1""

[HKEY_CLASSES_ROOT\exefile\shell\3 Ejecutar con afinidad\shell\5 Nº núcleos = 2]
@="2 núcleos (el 2 y 3)"

[HKEY_CLASSES_ROOT\exefile\shell\3 Ejecutar con afinidad\shell\5 Nº núcleos = 2\command]
@="cmd /c start "Afinidad CPU" /affinity 0C "%1""

[HKEY_CLASSES_ROOT\exefile\shell\3 Ejecutar con afinidad\shell\6 Nº núcleos = 1]
@="1 núcleo (el 0)"

[HKEY_CLASSES_ROOT\exefile\shell\3 Ejecutar con afinidad\shell\6 Nº núcleos = 1\command]
@="cmd /c start "Afinidad CPU" /affinity 01 "%1""

[HKEY_CLASSES_ROOT\exefile\shell\3 Ejecutar con afinidad\shell\7 Nº núcleos = 1]
@="1 núcleo (el 1)"

[HKEY_CLASSES_ROOT\exefile\shell\3 Ejecutar con afinidad\shell\7 Nº núcleos = 1\command]
@="cmd /c start "Afinidad CPU" /affinity 02 "%1""

[HKEY_CLASSES_ROOT\exefile\shell\3 Ejecutar con afinidad\shell\8 Nº núcleos = 1]
@="1 núcleo (el 2)"

[HKEY_CLASSES_ROOT\exefile\shell\3 Ejecutar con afinidad\shell\8 Nº núcleos = 1\command]
@="cmd /c start "Afinidad CPU" /affinity 04 "%1""

[HKEY_CLASSES_ROOT\exefile\shell\3 Ejecutar con afinidad\shell\9 Nº núcleos = 1]
@="1 núcleo (el 3)"

[HKEY_CLASSES_ROOT\exefile\shell\3 Ejecutar con afinidad\shell\9 Nº núcleos = 1\command]
@="cmd /c start "Afinidad CPU" /affinity 08 "%1""



Obviously, the words in castilian (spanish) are not obligatory (I don't know if this word is correct), it's possible to change it for language you want. In the same way, where says Afinidad CPU we can write (I think) whatever you want.Greetings.
 

My Computer

Computer type
PC/Desktop
OS
Windows 7/10 64 Bits
Back
Top