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.

    Thanks,
    -

    :)
     
    Eetheart, Apr 17, 2016
    #1
  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
    #2
  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
    #3
  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
    #4
  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
    #5
  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
    #6
  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
    #7
Thema:

Affinity Command in CMD

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

  2. Cmd command safe or not

    in Windows 10 Updates and Activation
    Cmd command safe or not: Hello , I just ran this command in CMDwmic path softwarelicensingservice get OA3xOriginalProductKeyIs this command safe?I ran it to get the product key of windows but after running it , no product key is showingIm suspicious this might throw the CPU to 100% utilisation which...
  3. Cmd command safe or not

    in Windows 10 Gaming
    Cmd command safe or not: Hello , I just ran this command in CMDwmic path softwarelicensingservice get OA3xOriginalProductKeyIs this command safe?I ran it to get the product key of windows but after running it , no product key is showingIm suspicious this might throw the CPU to 100% utilisation which...
  4. Cmd command safe or not

    in Windows 10 Software and Apps
    Cmd command safe or not: Hello , I just ran this command in CMDwmic path softwarelicensingservice get OA3xOriginalProductKeyIs this command safe?I ran it to get the product key of windows but after running it , no product key is showingIm suspicious this might throw the CPU to 100% utilisation which...
  5. Cmd command safe or not

    in Windows 10 Updates and Activation
    Cmd command safe or not: Hello , I just ran this command in CMDwmic path softwarelicensingservice get OA3xOriginalProductKeyIs this command safe?I ran it to get the product key of windows but after running it , no product key is showingIm suspicious this might throw the CPU to 100% utilisation which...
  6. Cmd command safe or not

    in Windows 10 Gaming
    Cmd command safe or not: Hello , I just ran this command in CMDwmic path softwarelicensingservice get OA3xOriginalProductKeyIs this command safe?I ran it to get the product key of windows but after running it , no product key is showingIm suspicious this might throw the CPU to 100% utilisation which...
  7. Cmd command safe or not

    in Windows 10 Software and Apps
    Cmd command safe or not: Hello , I just ran this command in CMDwmic path softwarelicensingservice get OA3xOriginalProductKeyIs this command safe?I ran it to get the product key of windows but after running it , no product key is showingIm suspicious this might throw the CPU to 100% utilisation which...
  8. wuauclt.exe CMD command lines

    in Windows 10 Gaming
    wuauclt.exe CMD command lines: 04/22/2022 - 10:59Hello,I am studying in a computer science school, and I work in a telecommunication company sandwich course. I have a project to do to validate my year.I have a Windows server 2012 R2.My goal is to update my computer with command lines.I have the constraint...
  9. 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]...
  10. 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...

Users found this page by searching for:

  1. cpu affinity cmd codes

    ,
  2. affinity cmd

    ,
  3. cmd cpu affinity windows 10