将 Windows 10 中的特定进程更改为高优先级

Change Specific Process in Windows 10 to High Priority?

本文关键字:进程 高优先级 Windows      更新时间:2023-10-16

有没有办法在Java中做到这一点?否则,用另一种语言做到这一点的最佳方式是什么;C++Windows API?

我只想在每次运行程序时将另一个正在运行的应用程序的一个特定进程更改为"高"。是的,我知道我可以使用Windows快捷方式来做到这一点,但我想在代码中实现它,最好是Java。

你在线程类
中有一个setPriority()方法检查这个

public static void main(String args[]) {
    Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
    // Your main code.
}

对于 c++,此 Windows API 调用 setPriorityClass 允许您更改进程优先级。
编辑:
如果要在 windows 10 中更改程序的优先级,请查看本文