批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程
[批处理文件精品]批处理版照片整理器[批处理文件精品]纯批处理备份&还原驱动在线第三方下载
返回列表 发帖

[转载代码] [PowerShell每日技巧]降低PowerShell进程的优先级(20140102)

When you run a PowerShell task, by default it has normal priority, and if the things your script does are CPU intensive, the overall performance of your machine may be affected.

To prevent this, you can assign your PowerShell process a lower priority and have it run only when CPU load allows. This will ensure that your PowerShell task won't degrade performance of other tasks.

This sample sets the priority to "below normal". You can also set it to "Idle" in which case your PowerShell script would only run when the machine has nothing else to do:

$process = Get-Process -Id $pid
$process.PriorityClass = 'BelowNormal'

http://powershell.com/cs/blogs/tips/archive/2014/01/02/lowering-powershell-process-priority.aspx

返回列表