What I get from that is that you use that command to start a process
in a given affinity. Correct? However, I am looking to change the
affinity of a given process that is already running, and cannot be
You can change the affinity using the GUI, ie Task Manager. Select the
Processes tab, highlight the process you want, right-click, and choose
"Affinity" from the context menu. This lets you change the affinity of the
running process.
There is no command-line tool to perform the same operation. You might be
able to do it with WMI Scripting.
Affinity is widely misunderstood. If your goal is to get better performance
for the game, you're probably wasting your time. Contrary to the simplistic
view, setting affinity does not generally improve performance. The unit of
scheduling in NT (including, here, Vista) is the Thread, not the Process. By
hard-binding a Process to a single CPU, you're actually lowering the chances
that the process's Threads will be scheduled to run. Besides, many or most
games are single-threaded anyway (they will only run on a single CPU, even
in multi-proc machines).
A couple of years ago I did a detailed performance analysis of a web
application (online banking) which a customer wanted to "optimise" it by
setting the affinity. After a week with Perfmon, the conclusion was that
there was no performance benefit whatever, and in fact a performance drop in
several scenarios, when a process is bound to a single CPU. The NT Scheduler
is pretty smart, and can be relied on to make good scheduling decisions in
most cases. If you have a performance bottleneck, it won't be because your
game is being starved for CPU. Or if it is, just close down the other
running processes before you start the game - that will be the more relaible
and effective way to get more CPU.
The main benefit of setting affinity is to provide comptibility for apps
which don't run well on multi-proc machines; you can fool them into thinking
they are running on a single proc machine.
You could try increasing the Priority of the game, so that it gets scheduled
to run at a higher probability - but again, the nett effect of this is often
less than obvious, and in most interactive applications, doesn't provide a
tangible benefit.