ProcessSetPriority

首页  后退  前进

ProcessSetPriority
down2

ProcessSetPriority

设置进程的优先级.

 

ProcessSetPriority ( "process", priority )

参数

process

进程的名称或 PID(进程标识符)

priority

优先级标志

   $PROCESS_LOW (0) = 空闲/低

   $PROCESS_BELOWNORMAL (1) = 低于正常

   $PROCESS_NORMAL (2) = 正常

   $PROCESS_ABOVENORMAL (3) = 高于正常

   $PROCESS_HIGH (4) = 高

   $PROCESS_REALTIME (5) = 实时(请谨慎使用,可能会导致系统不稳定)

 

常量定义在 "AutoItConstants.au3"

返回值

成功:

返回 1.

失败:

返回 0, @error 被设置为非 0 值.

@error:

1.

2 使用了不支持的优先级.

 

函数示例

Example()
Func Example()
    ; Run Notepad
    Run("notepad.exe")
    ; Wait 10 seconds for the Notepad window to appear.
    Local $hWnd = WinWait("[CLASS:Notepad]", "", 10)
    ; Set the priority of the Notepad process to "Idle/Low".
    ProcessSetPriority("notepad.exe", 0)
    ; Wait for 2 seconds.
    Sleep(2000)
    ; Close the Notepad window using the handle returned by WinWait.
    WinClose($hWnd)
EndFunc   ;==>Example

----------------------------------------

 

该函数可以通过命令调用 exect

参见:

ProcessList, _ProcessGetPriority

例子
copy

exect=ProcessSetPriority('TOTALCMD.EXE',3) ;; 将"高于平均水平"的优先级设置为TOTALCMD.EXE进程

up2

tcimage © Аверин Андрей для Total Commander Image Averin-And@yandex.ru