Location:
State:
Carrier
Country
Status

Affinity Command in CMD


In past Windows OS's , I was always able to change the CPU affinity with a simple line in a .bat file.

Code:
start /affinity # program.exe
# depends on which CPUs you want to run the program with.

Now, in Windows 10, this command does not work. I've tried with the -affinity # parameter, but without any luck. Yes, I am running both the .exe and the .bat file in Administrator mode, and yes I have full ownership of the folder both files are in.
Has the code changed somehow in Windows 10?

And before you answer, please don't refer to the solution of using the Task Manager to change affinity. I want a permanent solution, not a temporary one.

Thanks,
- Eetheart

How are you implementing the command? Affinity takes a hexadecimal number.
For exmaple:
processor 0: 0x1
processor 1: 0x2
processor 2: 0x4
processor 2 & 4: 0x14

You can use the calculator to get these numbers. In Programmer mode, go to the bit toggling keypad.



And before you state it. Yes this is how it worked in Windows 7 as well. Using plain decimal numbers (1-8 etc.) did not correspond to a CPU number. You just never double checked the command in task manager to make sure it set that process to the CPU you picked. I.E. using "affinity 3" did not restrict the process to processor 3. No, instead it restricted the process to CPU 0 and 1.

How are you implementing the command? Affinity takes a hexadecimal number.

And before you state it. Yes this is how it worked in Windows 7 as well. Using plain decimal numbers (1-8 etc.) did not correspond to a CPU number. You just never double checked the command in task manager to make sure it set that process to the CPU you picked. I.E. using "affinity 3" did not restrict the process to processor 3. No, instead it restricted the process to CPU 0 and 1.
Yes, I am perfectly aware of how the hexadecimal system works with Affinity. In my case I'm trying to make said program only run on CPU 0, thus the bat file looks like this:

Code:
Start /affinity 1 program.exe
But Windows seems to ignore it, running the program with all cores. And it's not just that specific program, I've tested with multiple and it's all the same. It works just fine with the exact same command, exact same program on my Windows 8.1 PC, but not on my Windows 10.

Maybe someone with Windows 10 can test and confirm to see if I'm the only one with this problem.

Works just fine "start /affinity 1 notepad.exe" is locked to CPU 0. Checked in Task Manager. And ever other variation I try.

Even tested on a Surface Pro 4, worked as expected.

Works just fine "start /affinity 1 notepad.exe" is locked to CPU 0. Checked in Task Manager. And ever other variation I try.

Even tested on a Surface Pro 4, worked as expected.
Thanks for testing it out. I'm baffled as to why it won't do that on mine. I'm gonna give this one a few more days as I've got another laptop arriving this week with Windows 10, so I'm going to test it on that one and see how it behaves.

UPDATE: After a restart, I tested it again and it worked. Don't ask me how or why, but I'm pleased! It seems like the good ol' restart trick still works wonders.

Affinity Command in CMD