Changing Windows process priority via command line
The command line syntax:
wmic process where name="AppName" CALL setpriority ProcessIDLevel
Example:
wmic process where name="calc.exe" CALL setpriority 32768
or
wmic process where name="calc.exe" CALL setpriority "above normal"
Priority:
- idle: 64 (or "idle")
- below normal: 16384 (or "below normal")
- normal: 32 (or "normal")
- above normal: 32768 (or "above normal")
- high priority: 128 (or "high priority")
- real time: 256 (or "realtime")
A small addition.
You can also use string values instead of integers (easier to memorize) like that:
wmic process where name="calc.exe" CALL setpriority "idle"
Possible values: "idle", "low", "below normal", "normal", "above normal", "high priority", "realtime"
PS. Don't forget the quotes, especially if using multiple words in a string value
From batch command line I would simply use PowerShell. This example starts calc.exe, finds its process and adjusts its priority class to "IDLE", aka LOW:
start /b /wait powershell.exe -command "calc.exe;$prog = Get-Process -Name calc;$prog.PriorityClass = [System.Diagnostics.ProcessPriorityClass]::IDLE"
Specify one of the following enumeration values: "Normal, Idle, High, RealTime, BelowNormal, AboveNormal
"
Here is the same thing from PowerShell with split lines:
calc.exe
$prog = Get-Process -Name calc
$prog.PriorityClass = [System.Diagnostics.ProcessPriorityClass]::IDLE