使exe优先级低

问题描述:

如何将.exe作为低优先级运行?我知道我可以去任务管理器,并手动更改那里的优先级设置,但有没有办法可以从.bat文件启动.exe,并使命令使.exe以给定优先级运行(在这种情况下为低)? .exe是我用C++编写的程序;我可以在C++代码中设置优先级吗?使exe优先级低

我正在运行windows xp。

在一个批处理文件,你可以使用start命令:

Starts a separate window to run a specified program or command. 

START ["title"] [/D path] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED] 
     [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL] 
     [/AFFINITY <hex affinity>] [/WAIT] [/B] [command/program] 
     [parameters] 

[ . . . ] 

    LOW   Start application in the IDLE priority class 
    NORMAL  Start application in the NORMAL priority class 
    HIGH  Start application in the HIGH priority class 
    REALTIME Start application in the REALTIME priority class 
    ABOVENORMAL Start application in the ABOVENORMAL priority class 
    BELOWNORMAL Start application in the BELOWNORMAL priority class 
+0

非常感谢你! – 2009-09-02 12:41:02

自愿放下你的进程优先级,使用SetPriorityClass。另请参阅完整discussion of process and thread priorities

请访问有关START命令张贴bobbymcr更多信息下面的链接:

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/start.mspx?mfr=true

http://forums.whirlpool.net.au/archive/875182

也可以运行cmd.exe的然后键入:START /?

它会显示关于START命令的所有信息。

问候,

,你可以在你的C++代码

BOOL WINAPI SetPriorityClass的顶部使用此功能( HANDLE hProcess, DWORD dwPriorityClass);

hProcess是您的进程的处理程序,它可以通过GetCurrentProcess()获取。

低优先级集dwPriorityClass = REALTIME_PRIORITY_CLASS