How to set processor affinity from Batch File for Windows XP?

JustADude picture JustADude · May 6, 2009 · Viewed 28.7k times · Source

I've got a dual processor machine and I would like to launch an executable via a batch file on both processors.

For example: (1) Launch Notepad.exe on Processor 1, and (2) Simultaneously, Notepad.exe on Processor 2

Currently, I'm using the following in my batch file, since my executable was "difficult" to launch and needed a return in order to run when launched: echo.|DoStuff.exe

Thus, I would like to launch it and have it run on each processor.

Thanks for any feedback provided.

P.S. I don't think "start" will work for me since I need to send in the return character to the executable as shown above with echo.

P.S.S. This is for a Windows XP solution. Thanks.

Answer

Rich.Carpenter picture Rich.Carpenter · May 6, 2009

start /affinity 1 notepad.exe

start /affinity 2 notepad.exe

(Windows7 has affinity for the start command, but XP does not. PSexec works though)