Start an Application Assigned to a Specific CPU in Windows Vista
Windows Vista has an option that lets you start an application and set the CPU affinity, which assigns the application to run on a specific CPU in a dual-core system.
To start an application you have to pass the affinity flag to the start utility in the command prompt. For instance, if you wanted to start notepad assigned to CPU, you could use the following command:
c:\windows\system32\cmd.exe /C start /affinity 1 notepad.exe
You can see in task manager that the process is only assigned to CPU 0
To start a process on CPU 0, use the following command switch:
/affinity 1
For CPU 1, use this switch:
/affinity 2
You can use a number up to the number of CPU cores or CPUs in your system. The affinity is essentially CPU core # + 1, so /affinity 5 would use CPU 4.
You can almost modify the shortcut for an item to make it run on the specific CPU, by just prepending the full "c:\windows\system32\cmd.exe /C start /affinity 1 " onto the shortcut target. The only drawback to this approach is that the command prompt window will briefly flash on the screen.


/affinity 5 does not use CPU 4
1 uses CPU0
2 uses CPU1
3 uses CPU0 and CPU1
4 uses CPU2
5 uses CPU2 and CPU0
6 uses CPU2 and CPU1
7 uses CPU2, CPU1, and CPU0
8 uses CPU3
9 uses CPU3 and CPU0
Convert the number to hex and reverse it to see which CPUs are to be used.
I'm really appreciative of what you have shared with me as I have some applications that I've needed to be able to control the affinity of a process that I spawn.
Thanks for your help.
Thanks to for this website. I've been work'n /w Vista going on two months and as your all aware. You have to unlearn what you've learned. Those older versions of window ie,. xp, xpro etc. have NOTHING on Vista. NO more just editing INI's is a thing of the past. But Wait There IS MORE! Hope anyone\everyone who aquires a version of vista like to read for this is NOT for the LAZY…..
Thanks
Is there anyway to force this with XP without having to reset the CPU affinity each time you launch the app?
Jason, try http://robpol86.com/pages/imagecfg.php
Originally this comes from the Win2K resource toolkit, so probably safer to get it from there.
It seems that start /affinity works just for some applications. For example by starting firefox with start /affinity 01 firefox.exe the affinity was not set correctly. Could anybody else prove this or have a workaround?