문제

I would like to lower the priority of the jobs that I start with Start-Job in PowerShell scripts. Is this possible?

도움이 되었습니까?

해결책

I used this trick right in a job's code (it can be optional, controlled by a parameter):

[System.Threading.Thread]::CurrentThread.Priority = 'Lowest'

Available priority values: Lowest, BelowNormal, Normal, AboveNormal, Highest

다른 팁

If you have launched it then you can use this:

 $a = gps powershell
 $a.PriorityClass = "BelowNormal"

Or you can use this using the key:

 Get-WmiObject Win32_process -filter 'name = "notepad.exe"' | foreach-object { $_.SetPriority(32) }

The priority codes are as follows:

 256 REALTIME
 128 HIGH_PRIORITY
 32768 ABOVE_NORMAL
 32 NORMAL
 16384 BELOW_NORMAL
 64 IDLE
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top