Windows 10: Affinity Command in CMD

Discus and support Affinity Command in CMD in Windows 10 Performance & Maintenance to solve the problem; 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[/quote]... Discussion in 'Windows 10 Performance & Maintenance' started by Eetheart, Apr 17, 2016.

  1. Eetheart Win User

    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[/quote] # 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.


    Eetheart, Apr 17, 2016
  2. Martmcd Win User

    CMD Command

    I don't think you said anything wrong and certainly no need to apologise.

    in order to use the net user command you must be logged in as a user with administrative permissions.

    I don't think you can use it to delete the user you are logged in as (it is certainly not a good idea)

    so assuming you are logged in as Arabi Enertech K.S.C (administrator) and wish to affect changes to Helloworld

    net user helloworld /delete - will delete the user Helloworld

    net user helloworld /Times: M-F, 8am-7pm, Sa, 8am-9pm restricts the time that Helloworld can log onto the machine to 08:00 - 19:00 Monday to Friday and 08:00 to 21:00 on Saturday

    note the days must either be abbreviated as follows MTWThFSaSu or written out in full, times can either be 12hr (am/pm) or 24hr.

    if you use the times switch without specifying a time range then the user will not be able to log on at all.

    net user helloworld /Times: All will allow the user to log on anytime

    net user helloworld /active:no will make the account inactive, it will not appear on the log on screen. a better example would be the built in administrator account which by default is inactive in order to use the built in administrator account
    you need to make it active - Net user Administrator /active:yes and when you have finished with it, turn it off again -
    net user Administrator /active:no

    you can join the commands so if you wanted to create a new user (newworld) that can use the computer only on Mondays between 9am and 5pm and set an initial password of abcdef that they must change when they first log on

    net user newworld abcdef /add /logonpasswordchg: yes /times: Monday, 09:00-17:00

    you are not likely to need the /domain switch in a home environment, it makes the changes on the domain controller, adding the /domain to the above example will create newworld user on the domain rather than the current machine

    I hope that helps a littleAffinity Command in CMD :)
    Martmcd, Apr 17, 2016
  3. CMD Command

    Dear sir,

    Superb sir its working : ) : ) but there is no syntax like this I mean when I enter the syntax wrong it shows that syntax of this command is so and so but how did you say try with double quotes. why sir : )

    Affinity Command in CMD [​IMG]

    I have one more doubt sir this is security hole I don't know I think so because whenever we searching in web how to bypass login password mostly peoples are suggesting this method. Even though Microsoft having this feature what is the main function of this
    command and could you please tell me all of the above commands with example like

    username [/delete] [/domain]

    username [/times:{times | all}]

    username [/active: {yes | no}]

    Thank you so much sir : ) : )
    BoobalanVarudaraju, Apr 17, 2016
  4. Affinity Command in CMD

    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.

    Affinity Command in CMD [​IMG]

    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.
    logicearth, Apr 17, 2016
  5. Eetheart Win User
    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[/quote] 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.
    Eetheart, Apr 17, 2016
  6. 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.
    logicearth, Apr 17, 2016
  7. Eetheart Win User
    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.
    Eetheart, Apr 4, 2018

Affinity Command in CMD

  1. Affinity Command in CMD - Similar Threads - Affinity Command CMD

  2. Cipher command on cmd not working

    in Windows 10 Network and Sharing
    Cipher command on cmd not working: [ATTACH] When I try to use the cipher command on cmd, this happens. Can anyone help? I am using windows 10 home edition
  3. Need CMD command to trim SSD!

    in Windows 10 Support
    Need CMD command to trim SSD!: Hello. Can someone give me a command I have to execute in order to trim my SSD? Thank you in advance! 172035
  4. CMD command meaning

    in Windows 10 Ask Insider
    CMD command meaning: Can someone please tell me what does this command mean?: Get-AppXPackage *WindowsStore* -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} submitted by /u/YanukiY [link] [comments]...
  5. Check disk at command prompt CMD

    in Windows 10 BSOD Crashes and Debugging
    Check disk at command prompt CMD: Hello,I also appealed to the Microsoft community where I also have a request to you, and those to ask you to give me all the useful check disk commands in the command prompt CMDThank you!Wait for response!A good day!...
  6. Help with commands of the cmd

    in Windows 10 Ask Insider
    Help with commands of the cmd: Hello fellow redditors i am looking for help with somo commands that i want to use on the cmd to the increase performance of my notebook. Well it's this command right here : powercfg -duplicatescheme e9a42b02-d5df-448d-aa00-03f14749eb61 I know it as to do with the power of...
  7. Check disk in command prompt CMD

    in Windows 10 BSOD Crashes and Debugging
    Check disk in command prompt CMD: Hello, I also appealed to the Microsoft community in which I also have a request to you, and those to ask you to give me all the useful command disk commands in command prompt CMD Thank you! Wait for response! A good day!...
  8. Run CMD commands on different drives

    in Windows 10 Support
    Run CMD commands on different drives: Hi all, I launch cmd on Windows 10 (drive C:) and want to run the command attrib -s -h *.* /s /d from there on the drive E. How to accomplish this, please? 135743
  9. Useful CMD commands (administrator)

    in Windows 10 BSOD Crashes and Debugging
    Useful CMD commands (administrator): Hello, Please send me all the CMD commands required for leptop and what role does CMD have in my order. I'm mentioning that on leptop I installed Windows 10 Home version 1809 Thank you! A wonderful day!...
  10. Cmd sleep command but with timer

    in Windows 10 Support
    Cmd sleep command but with timer: If you could help i found :\Windows\System32\rundll32.exe powrprof.dll,SetSuspendState Sleep but i need -t 180 secs which doesnt work with this and i dont want to use third party programs.. tyvm 97497

Users found this page by searching for:

  1. cpu affinity cmd codes

  2. affinity cmd

  3. cmd cpu affinity windows 10