• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

CPU Affinity Shortcut for a Program - Create in Windows


Posts
6
#22
After trying everything, this worked.
cmd.exe /c start "Sonar Platinum" /affinity E "C:\Program Files\Cakewalk\SONAR Platinum\sonarplt.exe"

I had to leave the quotation marks on. Go figure, after so many years of every instruction telling me "without quotes"

Thank you though. It works. Here's to hoping it helps with my problem.
 

My Computer

System One

  • OS
    Windows 10 64bit
    Computer type
    PC/Desktop
    System Manufacturer/Model Number
    HP

Brink

Administrator
Administrator
mvp
Posts
23,629
#23
Great news. :party:

Yeah, whenever there's a space in the path, you'll usually need to wrap it in quotes.
 

My Computer

System One

  • OS
    64-bit Windows 10
    Computer type
    PC/Desktop
    System Manufacturer/Model Number
    Custom self built
    CPU
    Intel i7-8700K OC'd to 5 GHz
    Motherboard
    ASUS ROG Maximus XI Formula Z390
    Memory
    16 GB (8GBx2) G.SKILL TridentZ DDR4 3200 MHz
    Graphics Card(s)
    ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
    Sound Card
    Integrated Digital Audio (S/PDIF)
    Monitor(s) Displays
    3 x 27" Asus VE278Q
    Screen Resolution
    1920x1080
    Hard Drives
    250GB Samsung 960 EVO M.2,
    256GB OCZ Vector,
    6TB WD Black WD6001FZWX
    8TB WD MyCloudEX2Ultra NAS
    PSU
    OCZ Series Gold OCZZ1000M 1000W
    Case
    Thermaltake Core P3
    Cooling
    Corsair Hydro H115i
    Keyboard
    Logitech wireless K800
    Mouse
    Logitech MX Master
    Internet Speed
    1 Gb/s Download and 35 Mb/s Upload
    Browser
    Internet Explorer 11
    Antivirus
    Malwarebyte Anti-Malware Premium
    Other Info
    Logitech Z625 speaker system,
    Logitech BRIO 4K Pro webcam,
    HP Color LaserJet Pro MFP M477fdn,
    Linksys EA9500 router,
    Arris SB8200 cable modem,
    APC SMART-UPS RT 1000 XL - SURT1000XLI,
    Lumia 1520 phone

Brink

Administrator
Administrator
mvp
Posts
23,629
#25

My Computer

System One

  • OS
    64-bit Windows 10
    Computer type
    PC/Desktop
    System Manufacturer/Model Number
    Custom self built
    CPU
    Intel i7-8700K OC'd to 5 GHz
    Motherboard
    ASUS ROG Maximus XI Formula Z390
    Memory
    16 GB (8GBx2) G.SKILL TridentZ DDR4 3200 MHz
    Graphics Card(s)
    ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
    Sound Card
    Integrated Digital Audio (S/PDIF)
    Monitor(s) Displays
    3 x 27" Asus VE278Q
    Screen Resolution
    1920x1080
    Hard Drives
    250GB Samsung 960 EVO M.2,
    256GB OCZ Vector,
    6TB WD Black WD6001FZWX
    8TB WD MyCloudEX2Ultra NAS
    PSU
    OCZ Series Gold OCZZ1000M 1000W
    Case
    Thermaltake Core P3
    Cooling
    Corsair Hydro H115i
    Keyboard
    Logitech wireless K800
    Mouse
    Logitech MX Master
    Internet Speed
    1 Gb/s Download and 35 Mb/s Upload
    Browser
    Internet Explorer 11
    Antivirus
    Malwarebyte Anti-Malware Premium
    Other Info
    Logitech Z625 speaker system,
    Logitech BRIO 4K Pro webcam,
    HP Color LaserJet Pro MFP M477fdn,
    Linksys EA9500 router,
    Arris SB8200 cable modem,
    APC SMART-UPS RT 1000 XL - SURT1000XLI,
    Lumia 1520 phone

m18xr2

Member
Member
Posts
56
#26
Hello mariachipr, and welcome to Eight Forums. :)

Please go ahead and post the command you used for the shortcut's location to see if anything may be wrong with it.
hey Brink sory bringing up back an old thread. the shortcut works great for launching application rather than launch application -> task manager -> manually change affinity.

however, what if say I wish to change affinity while a software/program already launched is there anyway to use a shortcut to still adjust the affinity for that currently running program without having to use task manager and manually change it? basically im looking to toggle different affinities with a running software without having to end process and relaunch it.

this might seem silly but i have many uses for it, to maximize my hardware performance due to software being unoptimized to take full advantage of my cpu. examples below:

using Broadwell-E CPU which has turbo max 3.0, it allow me to adjust frequency say 1 core at 5ghz while all core load at only 4ghz, when unoptimized software running on 1 core capable of using the highest frequency I set, works well with software that ONLY uses 1 core/thread. however in case I have a software which is semi-optimized, sometimes uses all cores, sometimes only uses 1 or 2 cores/threads, I want to be able to toggle affinities while software running under different scenarios to take advantage highest frequency possible.
 

My Computer

System One

  • OS
    windows 8.1 and server 2012 R2

Brink

Administrator
Administrator
mvp
Posts
23,629
#27
Hello m18xr2, :)

Here's a command you can use to change the CPU affinity of a running process.

wmic process where name="ProcessName" CALL setpriority ProcessIDLevel



Example:
wmic process where name="calc.exe" CALL setpriority 32768
or
wmic process where name="calc.exe" CALL setpriority "above normal"


ProcessIDLevel
idle: 64
below normal: 16384
normal: 32
above normal: 32768
high priority: 128
real time: 256
 

My Computer

System One

  • OS
    64-bit Windows 10
    Computer type
    PC/Desktop
    System Manufacturer/Model Number
    Custom self built
    CPU
    Intel i7-8700K OC'd to 5 GHz
    Motherboard
    ASUS ROG Maximus XI Formula Z390
    Memory
    16 GB (8GBx2) G.SKILL TridentZ DDR4 3200 MHz
    Graphics Card(s)
    ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
    Sound Card
    Integrated Digital Audio (S/PDIF)
    Monitor(s) Displays
    3 x 27" Asus VE278Q
    Screen Resolution
    1920x1080
    Hard Drives
    250GB Samsung 960 EVO M.2,
    256GB OCZ Vector,
    6TB WD Black WD6001FZWX
    8TB WD MyCloudEX2Ultra NAS
    PSU
    OCZ Series Gold OCZZ1000M 1000W
    Case
    Thermaltake Core P3
    Cooling
    Corsair Hydro H115i
    Keyboard
    Logitech wireless K800
    Mouse
    Logitech MX Master
    Internet Speed
    1 Gb/s Download and 35 Mb/s Upload
    Browser
    Internet Explorer 11
    Antivirus
    Malwarebyte Anti-Malware Premium
    Other Info
    Logitech Z625 speaker system,
    Logitech BRIO 4K Pro webcam,
    HP Color LaserJet Pro MFP M477fdn,
    Linksys EA9500 router,
    Arris SB8200 cable modem,
    APC SMART-UPS RT 1000 XL - SURT1000XLI,
    Lumia 1520 phone

m18xr2

Member
Member
Posts
56
#28
Hello m18xr2, :)

Here's a command you can use to change the CPU affinity of a running process.

wmic process where name="ProcessName" CALL setpriority ProcessIDLevel



Example:
wmic process where name="calc.exe" CALL setpriority 32768
or
wmic process where name="calc.exe" CALL setpriority "above normal"


ProcessIDLevel
idle: 64
below normal: 16384
normal: 32
above normal: 32768
high priority: 128
real time: 256
ty for quick respond, this is changing priority though but not changing affinity during a process, is it possible to change to different affinity while a process is already running without task manager and just use of a shortcut or CMD line?
 

My Computer

System One

  • OS
    windows 8.1 and server 2012 R2

Brink

Administrator
Administrator
mvp
Posts
23,629
#29

My Computer

System One

  • OS
    64-bit Windows 10
    Computer type
    PC/Desktop
    System Manufacturer/Model Number
    Custom self built
    CPU
    Intel i7-8700K OC'd to 5 GHz
    Motherboard
    ASUS ROG Maximus XI Formula Z390
    Memory
    16 GB (8GBx2) G.SKILL TridentZ DDR4 3200 MHz
    Graphics Card(s)
    ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
    Sound Card
    Integrated Digital Audio (S/PDIF)
    Monitor(s) Displays
    3 x 27" Asus VE278Q
    Screen Resolution
    1920x1080
    Hard Drives
    250GB Samsung 960 EVO M.2,
    256GB OCZ Vector,
    6TB WD Black WD6001FZWX
    8TB WD MyCloudEX2Ultra NAS
    PSU
    OCZ Series Gold OCZZ1000M 1000W
    Case
    Thermaltake Core P3
    Cooling
    Corsair Hydro H115i
    Keyboard
    Logitech wireless K800
    Mouse
    Logitech MX Master
    Internet Speed
    1 Gb/s Download and 35 Mb/s Upload
    Browser
    Internet Explorer 11
    Antivirus
    Malwarebyte Anti-Malware Premium
    Other Info
    Logitech Z625 speaker system,
    Logitech BRIO 4K Pro webcam,
    HP Color LaserJet Pro MFP M477fdn,
    Linksys EA9500 router,
    Arris SB8200 cable modem,
    APC SMART-UPS RT 1000 XL - SURT1000XLI,
    Lumia 1520 phone
Posts
2
#30
My apologies as this is for Windows 10....

First, thank you for the information, it's very informative! But I have a problem that I need help with, I have a dual processor system, with 56 threads total. Win10 affinity selection shows threads 0-27 (Node 0) and then repeats for the 2nd processor with 0-27 (Node 2).

What modifications to the original instructions would I need to follow for this system?

uhoh3.png

Three of the GPU's are controlled from one CPU, and the 4th is controlled from the second CPU. I need to save a few threads from the 1st CPU to assist/feed the GPU's attached to it.
 

My Computer

System One

  • OS
    Windows 10
    Computer type
    PC/Desktop
    System Manufacturer/Model Number
    custom
    CPU
    Dual XEON E5-2695-V3
    Motherboard
    ASRock EP2C612
    Memory
    32 GB Generic registered
    Graphics Card(s)
    Quad Nvidia GTX 1080
    Sound Card
    onboard
    Monitor(s) Displays
    none, TeamViewer
    Screen Resolution
    n/a, TeamViewer
    Hard Drives
    Samsung 850 Pro SSD, 256Gb
    PSU
    Corsair AX1200 (barely enough! :D )
    Case
    Skeleton, http://spotswoodcomputercases.com/wp/?page_id=892
    Cooling
    Dual Hyper 212EVO, CoolerMaster
    Keyboard
    none, TeamViewer
    Mouse
    none, TeamViewer
    Internet Speed
    Cable modem, 21+ down, 3 up
    Browser
    Firefox/Chrome
    Antivirus
    Microsoft
    Other Info
    https://forums.anandtech.com/threads/old-thread-revived-need-help-naming-a-rig.2441945/page-4#post-38874541

Brink

Administrator
Administrator
mvp
Posts
23,629
#31
Hello Tony, and welcome to Eight Forums. :)

I haven't tested with multiple processors, but you you should be able to use the same steps. You would just have a 56 digit binary number for step 1.

To verify, check to see what the CPU affinity shows for the running process after running it from the shortcut.
 

My Computer

System One

  • OS
    64-bit Windows 10
    Computer type
    PC/Desktop
    System Manufacturer/Model Number
    Custom self built
    CPU
    Intel i7-8700K OC'd to 5 GHz
    Motherboard
    ASUS ROG Maximus XI Formula Z390
    Memory
    16 GB (8GBx2) G.SKILL TridentZ DDR4 3200 MHz
    Graphics Card(s)
    ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
    Sound Card
    Integrated Digital Audio (S/PDIF)
    Monitor(s) Displays
    3 x 27" Asus VE278Q
    Screen Resolution
    1920x1080
    Hard Drives
    250GB Samsung 960 EVO M.2,
    256GB OCZ Vector,
    6TB WD Black WD6001FZWX
    8TB WD MyCloudEX2Ultra NAS
    PSU
    OCZ Series Gold OCZZ1000M 1000W
    Case
    Thermaltake Core P3
    Cooling
    Corsair Hydro H115i
    Keyboard
    Logitech wireless K800
    Mouse
    Logitech MX Master
    Internet Speed
    1 Gb/s Download and 35 Mb/s Upload
    Browser
    Internet Explorer 11
    Antivirus
    Malwarebyte Anti-Malware Premium
    Other Info
    Logitech Z625 speaker system,
    Logitech BRIO 4K Pro webcam,
    HP Color LaserJet Pro MFP M477fdn,
    Linksys EA9500 router,
    Arris SB8200 cable modem,
    APC SMART-UPS RT 1000 XL - SURT1000XLI,
    Lumia 1520 phone
Posts
2
#32
Using the following test item:

C:\Windows\System32\cmd.exe /c start "Chrome" /affinity 80000000000000 "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" (aiming for the 56th thread)

I get:

uhoh3.png

It works! Thanks so much! :cool:
 

My Computer

System One

  • OS
    Windows 10
    Computer type
    PC/Desktop
    System Manufacturer/Model Number
    custom
    CPU
    Dual XEON E5-2695-V3
    Motherboard
    ASRock EP2C612
    Memory
    32 GB Generic registered
    Graphics Card(s)
    Quad Nvidia GTX 1080
    Sound Card
    onboard
    Monitor(s) Displays
    none, TeamViewer
    Screen Resolution
    n/a, TeamViewer
    Hard Drives
    Samsung 850 Pro SSD, 256Gb
    PSU
    Corsair AX1200 (barely enough! :D )
    Case
    Skeleton, http://spotswoodcomputercases.com/wp/?page_id=892
    Cooling
    Dual Hyper 212EVO, CoolerMaster
    Keyboard
    none, TeamViewer
    Mouse
    none, TeamViewer
    Internet Speed
    Cable modem, 21+ down, 3 up
    Browser
    Firefox/Chrome
    Antivirus
    Microsoft
    Other Info
    https://forums.anandtech.com/threads/old-thread-revived-need-help-naming-a-rig.2441945/page-4#post-38874541

Brink

Administrator
Administrator
mvp
Posts
23,629
#33
Great news. :party:
 

My Computer

System One

  • OS
    64-bit Windows 10
    Computer type
    PC/Desktop
    System Manufacturer/Model Number
    Custom self built
    CPU
    Intel i7-8700K OC'd to 5 GHz
    Motherboard
    ASUS ROG Maximus XI Formula Z390
    Memory
    16 GB (8GBx2) G.SKILL TridentZ DDR4 3200 MHz
    Graphics Card(s)
    ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
    Sound Card
    Integrated Digital Audio (S/PDIF)
    Monitor(s) Displays
    3 x 27" Asus VE278Q
    Screen Resolution
    1920x1080
    Hard Drives
    250GB Samsung 960 EVO M.2,
    256GB OCZ Vector,
    6TB WD Black WD6001FZWX
    8TB WD MyCloudEX2Ultra NAS
    PSU
    OCZ Series Gold OCZZ1000M 1000W
    Case
    Thermaltake Core P3
    Cooling
    Corsair Hydro H115i
    Keyboard
    Logitech wireless K800
    Mouse
    Logitech MX Master
    Internet Speed
    1 Gb/s Download and 35 Mb/s Upload
    Browser
    Internet Explorer 11
    Antivirus
    Malwarebyte Anti-Malware Premium
    Other Info
    Logitech Z625 speaker system,
    Logitech BRIO 4K Pro webcam,
    HP Color LaserJet Pro MFP M477fdn,
    Linksys EA9500 router,
    Arris SB8200 cable modem,
    APC SMART-UPS RT 1000 XL - SURT1000XLI,
    Lumia 1520 phone

devinori

New Member
Posts
4
#34
Hello Brink,i treid to change affinity but did't work.I tried c:\Windows\system32\cmd.exe /c start /affinity 1 notepad.exe,it worked.I want to change affinity of MetaTredaer4 of XM,I tried below

c:\Windows\system32\cmd.exe /c start "terminal" /affinity 1 "c:\fx\xm\terminal.exe"
(I installed some MT4,so I installed MT4 of XM in this folder(c:\fx\xm).)
but it tells me that windows cannot find "terminal.exe".

Full path of application is correct,is the program name wrong?
 

My Computer

System One

  • OS
    windows10 pro

Brink

Administrator
Administrator
mvp
Posts
23,629
#35
Hello devinori, and welcome to Eight Forums. :)

If you set the CPU Affinity for "terminal.exe" via Task Manager instead, is able to do so using that method?
 

My Computer

System One

  • OS
    64-bit Windows 10
    Computer type
    PC/Desktop
    System Manufacturer/Model Number
    Custom self built
    CPU
    Intel i7-8700K OC'd to 5 GHz
    Motherboard
    ASUS ROG Maximus XI Formula Z390
    Memory
    16 GB (8GBx2) G.SKILL TridentZ DDR4 3200 MHz
    Graphics Card(s)
    ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
    Sound Card
    Integrated Digital Audio (S/PDIF)
    Monitor(s) Displays
    3 x 27" Asus VE278Q
    Screen Resolution
    1920x1080
    Hard Drives
    250GB Samsung 960 EVO M.2,
    256GB OCZ Vector,
    6TB WD Black WD6001FZWX
    8TB WD MyCloudEX2Ultra NAS
    PSU
    OCZ Series Gold OCZZ1000M 1000W
    Case
    Thermaltake Core P3
    Cooling
    Corsair Hydro H115i
    Keyboard
    Logitech wireless K800
    Mouse
    Logitech MX Master
    Internet Speed
    1 Gb/s Download and 35 Mb/s Upload
    Browser
    Internet Explorer 11
    Antivirus
    Malwarebyte Anti-Malware Premium
    Other Info
    Logitech Z625 speaker system,
    Logitech BRIO 4K Pro webcam,
    HP Color LaserJet Pro MFP M477fdn,
    Linksys EA9500 router,
    Arris SB8200 cable modem,
    APC SMART-UPS RT 1000 XL - SURT1000XLI,
    Lumia 1520 phone

Brink

Administrator
Administrator
mvp
Posts
23,629
#37
In that case, it should work with the command as well. Odd.

If you "open file location" from Task Manager and copy path for terminal.exe, does it show the same path you posted?
 

My Computer

System One

  • OS
    64-bit Windows 10
    Computer type
    PC/Desktop
    System Manufacturer/Model Number
    Custom self built
    CPU
    Intel i7-8700K OC'd to 5 GHz
    Motherboard
    ASUS ROG Maximus XI Formula Z390
    Memory
    16 GB (8GBx2) G.SKILL TridentZ DDR4 3200 MHz
    Graphics Card(s)
    ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
    Sound Card
    Integrated Digital Audio (S/PDIF)
    Monitor(s) Displays
    3 x 27" Asus VE278Q
    Screen Resolution
    1920x1080
    Hard Drives
    250GB Samsung 960 EVO M.2,
    256GB OCZ Vector,
    6TB WD Black WD6001FZWX
    8TB WD MyCloudEX2Ultra NAS
    PSU
    OCZ Series Gold OCZZ1000M 1000W
    Case
    Thermaltake Core P3
    Cooling
    Corsair Hydro H115i
    Keyboard
    Logitech wireless K800
    Mouse
    Logitech MX Master
    Internet Speed
    1 Gb/s Download and 35 Mb/s Upload
    Browser
    Internet Explorer 11
    Antivirus
    Malwarebyte Anti-Malware Premium
    Other Info
    Logitech Z625 speaker system,
    Logitech BRIO 4K Pro webcam,
    HP Color LaserJet Pro MFP M477fdn,
    Linksys EA9500 router,
    Arris SB8200 cable modem,
    APC SMART-UPS RT 1000 XL - SURT1000XLI,
    Lumia 1520 phone

devinori

New Member
Posts
4
#38
I open "file location" and copy the path,it is same I posted.
I don't know the cause of my trouble.
Because my windows is japanese ver.?(but the path doesn't include japanese character...)
 

My Computer

System One

  • OS
    windows10 pro

Brink

Administrator
Administrator
mvp
Posts
23,629
#40
Odd, but I'm glad to hear you got it sorted. :party:
 

My Computer

System One

  • OS
    64-bit Windows 10
    Computer type
    PC/Desktop
    System Manufacturer/Model Number
    Custom self built
    CPU
    Intel i7-8700K OC'd to 5 GHz
    Motherboard
    ASUS ROG Maximus XI Formula Z390
    Memory
    16 GB (8GBx2) G.SKILL TridentZ DDR4 3200 MHz
    Graphics Card(s)
    ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
    Sound Card
    Integrated Digital Audio (S/PDIF)
    Monitor(s) Displays
    3 x 27" Asus VE278Q
    Screen Resolution
    1920x1080
    Hard Drives
    250GB Samsung 960 EVO M.2,
    256GB OCZ Vector,
    6TB WD Black WD6001FZWX
    8TB WD MyCloudEX2Ultra NAS
    PSU
    OCZ Series Gold OCZZ1000M 1000W
    Case
    Thermaltake Core P3
    Cooling
    Corsair Hydro H115i
    Keyboard
    Logitech wireless K800
    Mouse
    Logitech MX Master
    Internet Speed
    1 Gb/s Download and 35 Mb/s Upload
    Browser
    Internet Explorer 11
    Antivirus
    Malwarebyte Anti-Malware Premium
    Other Info
    Logitech Z625 speaker system,
    Logitech BRIO 4K Pro webcam,
    HP Color LaserJet Pro MFP M477fdn,
    Linksys EA9500 router,
    Arris SB8200 cable modem,
    APC SMART-UPS RT 1000 XL - SURT1000XLI,
    Lumia 1520 phone

Users Who Are Viewing This Thread (Users: 0, Guests: 2)