Bob*_*obs 51 windows priority command-line process
我想通过命令行更改 Windows 进程优先级。
我怎样才能做到这一点?
Bob*_*obs 65
命令行语法:
wmic process where name="AppName" CALL setpriority ProcessIDLevel
Run Code Online (Sandbox Code Playgroud)
例子:
wmic process where name="calc.exe" CALL setpriority 32768
Run Code Online (Sandbox Code Playgroud)
或者
wmic process where name="calc.exe" CALL setpriority "above normal"
Run Code Online (Sandbox Code Playgroud)
优先事项:
Ash*_*ray 13
一个小小的补充。
您还可以使用字符串值代替整数(更容易记忆),如下所示:
wmic process where name="calc.exe" CALL setpriority "idle"
Run Code Online (Sandbox Code Playgroud)
可能的值:“空闲”、“低”、“低于正常”、“正常”、“高于正常”、“高优先级”、“实时”
附注。不要忘记引号,尤其是在字符串值中使用多个单词时
在批处理命令行中,我将简单地使用 PowerShell。此示例启动 calc.exe,查找其进程并将其优先级调整为“IDLE”,即 LOW:
start /b /wait powershell.exe -command "calc.exe;$prog = Get-Process -Name calc;$prog.PriorityClass = [System.Diagnostics.ProcessPriorityClass]::IDLE"
Run Code Online (Sandbox Code Playgroud)
指定以下枚举值之一:“ Normal, Idle, High, RealTime, BelowNormal, AboveNormal
”
这是来自 PowerShell 的带有分割线的相同内容:
calc.exe
$prog = Get-Process -Name calc
$prog.PriorityClass = [System.Diagnostics.ProcessPriorityClass]::IDLE
Run Code Online (Sandbox Code Playgroud)
除了现有的答案,问题Windows Equivalent of 'nice' 列出了更多的解决方案:
此外,旧的SetPriority实用程序可能仍然有效,但我已经很多年没有尝试过了。
其中一些解决方案可能不适用于系统服务或可能需要以管理员身份运行。
归档时间: |
|
查看次数: |
102073 次 |
最近记录: |