如何將.exe
作爲低優先級運行?我知道我可以去任務管理器,並手動更改那裏的優先級設置,但有沒有辦法可以從.bat
文件啓動.exe
,並使命令使.exe以給定優先級運行(在這種情況下爲低)? .exe是我用C++編寫的程序;我可以在C++代碼中設置優先級嗎?使exe優先級低
我正在運行windows xp。
如何將.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
自願放下你的進程優先級,使用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
非常感謝你! – 2009-09-02 12:41:02