1.    17 Apr 2016 #1
    Join Date : Apr 2016
    Posts : 3
    Windows XP, Windows 7, Windows 8.1, Windows 10, Linux Mint 17.3, OS X 10.9

    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
      My ComputerSystem Spec
  2.    18 Apr 2016 #2
    Join Date : Mar 2015
    Posts : 234
    Windows 10 Pro (x64)

    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.

    Click image for larger version. 

Name:	calculator.png 
Views:	3 
Size:	12.3 KB 
ID:	75374

    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.
      My ComputerSystem Spec
  3.    18 Apr 2016 #3
    Join Date : Apr 2016
    Posts : 3
    Windows XP, Windows 7, Windows 8.1, Windows 10, Linux Mint 17.3, OS X 10.9
    Thread Starter

    Quote Originally Posted by logicearth View Post
    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.
      My ComputerSystem Spec
  4.    18 Apr 2016 #4
    Join Date : Mar 2015
    Posts : 234
    Windows 10 Pro (x64)

    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.
      My ComputerSystem Spec
  5.    18 Apr 2016 #5
    Join Date : Apr 2016
    Posts : 3
    Windows XP, Windows 7, Windows 8.1, Windows 10, Linux Mint 17.3, OS X 10.9
    Thread Starter

    Quote Originally Posted by logicearth View Post
    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.
      My ComputerSystem Spec

 


Similar Threads
Thread Forum
Performance & Maintenance Run SFC Command in Windows 10
The SFC command scans the integrity of all protected system files and replaces incorrect versions with correct Microsoft versions. This tutorial will show you how to run the sfc command at boot or in Windows 10 to attempt to repair corrupted or...
Tutorials
Net Command
Hi everyone, Every time I turn my laptop on a message appears that says "NET COMMAND" Do you want this app to make changes to your pc. It has only started doing it in the last week. Any help to stop it would be appreciated.
General Support
W10 App CPU Affinity shortcut
Greetings everyone I am hoping somebody out there can help me. I wish to create a shortcut for a .exe app where I set the CPU affinity to use 3 of my 4 cores. I have tried using my old powershell batch that worked with windows 7 and I have tried...
Software and Apps
Solved Command Prompt
How to call up "command Prompt (Admin) from the "run" dialog box win 10 Home?
General Support
Command Prompt?
Guys, I'm going to try one last time. The error code I received told to me to empty files and then "Run the command prompt as an administrator"?? Then, type wuauclt.exe/update now??......I don't know what run the command prompt means. I have no...
General Support
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 23:36.
Find Us
Twitter Facebook Google+ Ten Forums iOS App Ten Forums Android App



Windows 10 Forums