The start
Windows shell command (in cmd.exe) appears to be able to start a process with a chosen processor affinity, rather than starting the process then setting the chosen processor affinity some (small) period of time after it has started.
start /affinity 2 something.exe
Is there a way to do the same from within a .NET application either with or without using P-Invoke? Calling out to cmd.exe /C start ...
doesn't count.
The Process
class has the ProcessorAffinity
property, but it throws InvalidOperationException
if you try to set it before having called the Start
method.