← All posts 中文版 →

Can Windows Switch to High Performance When the CPU Gets Busy?

Not from its settings. Neither power plans nor Power mode has a setting that reacts to how busy the CPU is, and Task Scheduler has no "CPU usage is above X" trigger. If you want your PC to move to High performance while you convert files, export video or run a big job, and move back when it's done, you have two options: write a small PowerShell script that keeps running, or use PowerDoze's Switch when the CPU is busy. This post gives you a script you can paste as is, and explains what each option can't do.

Is there really no setting for this in Windows?

No. You pick a power plan in Control Panel > Power Options, and Windows' Power mode in Settings > System > Power & battery (on a desktop with no battery, that page is just called Power). Neither one has an option like "switch to something else while the CPU is busy".

Task Scheduler can run a plan-switching command at a set time, at startup, at sign-in, and so on, but none of its triggers is "CPU usage is above X." When you create a task from the command line (schtasks /create), the schedule types you can choose are: every few minutes, hourly, daily, weekly, monthly, once, at startup, at sign-in, when idle, and when a specific event occurs. There's "when idle", but no opposite "when busy".

Windows' built-in Performance Monitor can also set up an alert that runs a Task Scheduler task when CPU usage goes above a threshold you choose. You'd need one alert for busy and another for calm, though, and we haven't tried using alerts to switch power plans, so this post doesn't cover that approach.

The approach in this post keeps a program running, and that program checks CPU usage itself. You can write that yourself, or let an app do it.

One line of PowerShell reads your CPU usage

Type powershell into the search box on the taskbar, open Windows PowerShell, type this line and press Enter:

(Get-CimInstance Win32_Processor).LoadPercentage

It returns a whole number from 0 to 100: your CPU's current usage, in percent. We ran this line on our test PC.

A 12-line script: High performance when busy, Balanced when calm

Paste the whole block into a Windows PowerShell window and press Enter, and it starts running. The first three lines hold the numbers you can change: the two thresholds (in percent), how many seconds each must last, and how often it checks.

$busyAt = 80; $busySec = 30   # CPU at 80% or more for 30 seconds in a row: switch to High performance
$calmAt = 30; $calmSec = 60   # CPU at 30% or less for 60 seconds in a row: switch back to Balanced
$every = 5                    # check every 5 seconds
$busySince = $null; $calmSince = $null; $boosted = $false
while ($true) {
  $cpu = (Get-CimInstance Win32_Processor | Measure-Object -Property LoadPercentage -Average).Average; $now = Get-Date
  if ($null -ne $cpu -and $cpu -ge $busyAt) { if (-not $busySince) { $busySince = $now } } else { $busySince = $null }
  if ($null -ne $cpu -and $cpu -le $calmAt) { if (-not $calmSince) { $calmSince = $now } } else { $calmSince = $null }
  if (-not $boosted -and $busySince -and ($now - $busySince).TotalSeconds -ge $busySec) { powercfg /setactive SCHEME_MIN; $boosted = $true }
  if ($boosted -and $calmSince -and ($now - $calmSince).TotalSeconds -ge $calmSec) { powercfg /setactive SCHEME_BALANCED; $boosted = $false }
  Start-Sleep -Seconds $every
}

Here's what it does:

  1. About every 5 seconds, it reads CPU usage. It's the same reading as the one-line command that reads CPU usage, with one extra step that takes the average.
  2. The first time it reads 80% or more, it notes the time. Any reading below 80% starts the timer over. Once 30 seconds have passed since that first reading, it switches to the High performance plan.
  3. After that, it watches for 30% or less the same way: after 60 seconds in a row, it switches back to the Balanced plan.
  4. When CPU usage is between 30% and 80%, or a reading fails, both timers start over and the power plan stays as it is.

There are two thresholds so the plan doesn't flip back and forth. With a single threshold, say 60%, your CPU might bounce between 55% and 65% during an export, and your power plan would switch over, switch back, and switch over again. A gap between the two thresholds stops that.

Think of a supermarket manager opening checkouts. A second till opens only when more than eight people have been queuing for a while, and it closes only after the line has stayed under three for a while. If the manager watched a single number, say five people, a line wobbling between four and six would have the cashier sitting down and standing up all afternoon.

SCHEME_MIN and SCHEME_BALANCED in the script are aliases for Windows' built-in power plans, so you don't have to type the plan's long ID. SCHEME_MIN is High performance, SCHEME_BALANCED is Balanced, and there's also SCHEME_MAX for Power saver. The names feel backwards: MIN and MAX describe how much power is saved, and High performance saves the least. You can check with powercfg /aliases; we ran it on our test PC.

Six things you should know before using this script

  • The window has to stay open. Close the Windows PowerShell window and the script stops. If you close it while High performance is on, it won't switch you back. After a restart, you have to paste it again.
  • It switches back to Balanced, not to the plan you were using. If you normally use a plan you made yourself, run powercfg /list, copy that plan's ID (the GUID, a long string of letters and numbers), and put it in place of SCHEME_BALANCED.
  • It only looks at the CPU. When your graphics card is busy but CPU usage is low, it won't switch.
  • It assumes you start on Balanced. It only switches back to Balanced after it has switched to High performance first.
  • Some PCs don't have a High performance plan. Modern Standby is a kind of sleep that many newer laptops use. Microsoft's documentation says PCs that support Modern Standby can only use Balanced, or plans copied from Balanced. On one of those, powercfg /list may not show High performance, and the script can't switch to it.
  • Work or school PCs may not let you switch. By default, Windows lets standard users switch power plans, but an administrator can lock that with Group Policy.

How does PowerDoze's Switch when the CPU is busy work?

It's a Pro feature in the Microsoft Store version of PowerDoze (2.4.0 and later). Open the Smart Detection page in PowerDoze and look for the Switch when the CPU is busy toggle. It's off out of the box, so you turn it on yourself. On the free version you'll see a locked card that says Available with Pro.

Once it's on, PowerDoze's background program reads the whole PC's CPU usage about every 3 seconds. Each reading is the average since the previous one. It isn't a single core, and it doesn't include the graphics card. It decides the same way the script does, with two thresholds: the PC has to stay busy for the whole time you set before it switches, and one reading below the threshold restarts the timer. When CPU usage sits between the two thresholds, it keeps the current state.

The settings on the card and their defaults:

Setting on screenDefault and range
Counts as busy at 80% CPU or more80% by default, adjustable from 10% to 100%
Busy for at least30 seconds by default
While busy, switch toThe built-in High performance mode by default, or any of your other PowerDoze power modes
Counts as calm at 30% CPU or less30% by default, adjustable from 5% to 95%, and it must be lower than the busy threshold
Calm for at least60 seconds by default

Both "for at least" settings are drop-down menus: 5, 10, 15 or 30 seconds, or 1, 2, 5, 10, 30 or 60 minutes.

When the switch goes through, you get a notification titled CPU Load. With the default settings it reads: Your PC is busy, so it switched to High performance. The card also shows whether the PC is busy right now and the current CPU usage.

When PowerDoze switches its own power modes, it changes Windows' power plan. It doesn't change Windows' Power mode. The built-in High performance mode uses Windows' High performance plan.

Once things calm down, your schedule decides the mode; it doesn't restore the old one

The card's description says your usual mode comes back once the PC calms down. What actually happens is this: when the PC calms down, PowerDoze cancels the mode change the CPU rule asked for, and hands the decision to your time-based schedule or your other rules. It doesn't remember which mode you had before and put that one back.

So if your busy stretch runs past the point where your schedule changes to its next time slot, you'll land on the new slot's mode when things calm down. You won't get a CPU Load notification when it switches back.

When it clashes with a manual switch or another rule, which one wins?

From highest priority to lowest:

  1. The low-battery rule comes first.
  2. Next is a mode you picked by hand, or one you picked with Apply temporarily. However busy the CPU gets during that time, it won't override your choice. When Apply temporarily ends, the CPU rule takes effect again on its own if the PC is still busy.
  3. Then come the CPU-busy, foreground-app, Wi-Fi and away-mode rules. They sit on the same level, and whichever asked most recently wins. The CPU rule asks only once per busy stretch; if another rule on that level asks after it, the CPU rule steps aside.
  4. Your time-based schedule comes last.

Switching by app is a different approach: it switches while an app you chose (a video editor, for example) is in the foreground, and when you move to an app with no rule, it goes back to what your schedule says. Here's where they differ: if you start an export and then switch to your browser, the editor is no longer in the foreground, so the app rule stops applying. The CPU rule looks at how busy the PC is, whatever app is in front.

Frequently asked questions

After the PC wakes from sleep, does PowerDoze keep counting the busy time?

No. If more than 15 seconds pass between two CPU readings (after waking from sleep, for example), or a reading fails, the count starts over.

What happens if I click Resume schedule on the home screen while the PC is still busy?

PowerDoze goes back to the mode your schedule has for this time slot and won't switch again during this busy stretch. It switches again the next time the PC gets busy, after it has calmed down first. The button sits next to the home-screen note saying which mode your schedule rule should be applying now, so you won't see it without a schedule.

Does PowerDoze switch to High performance on battery too?

Yes. The feature doesn't tell plugged in and battery apart, and there are no separate settings for them. If you don't want High performance on battery, turn the switch off before you unplug.

If my Pro runs out, do I lose these settings?

No. The feature pauses, but your settings are kept, and it picks up again once you have Pro.

What we can't confirm yet

  • We didn't run the two lines in the script that switch power plans (powercfg /setactive) on our test PC, because that PC's power settings can't be changed. When you run it, those two lines will really switch your power plan. We did run the line that reads CPU usage, and the whole loop with those two lines swapped for lines that just print text.
  • "It won't switch when the graphics card is busy but CPU usage is low" is our own conclusion from the fact that PowerDoze only reads CPU usage. You might see it with some games or with GPU rendering, but we haven't tested it with a game or a rendering app.
  • What this post says about PowerDoze comes from reading its code. We haven't checked every item by hand in the app.

Limits of this post

If you only export a video now and then, you don't need any automatic switching. Before the export, pick High performance in Control Panel > Power Options, and pick Balanced again when it's done. Or set Windows' Power mode to Best performance in Settings > System > Power & battery (available when your power plan is Balanced or a plan copied from Balanced). This post explains how Windows' Power mode differs from power plans. You don't need us, and you don't need a script window either.

To switch with a key press, see switching power plans with a keyboard shortcut. To switch now and have it switch back when time is up, see switching power plans temporarily.

Both the script and PowerDoze only look at CPU usage. If your work mostly keeps the graphics card busy, neither may switch.

Don't want to remember to switch before every export, or keep a PowerShell window open all day? Turn on Switch when the CPU is busy in PowerDoze: it switches when your PC gets busy, and hands things back to your schedule once it calms down.

Get PowerDoze from the Microsoft StoreGet PowerDoze from the Microsoft Store

Nisonxi

I'm Nisonxi, the developer behind PowerDoze. I built it because my own Windows desktop idled all day at near-full power and no existing tool could read the situation and switch on its own. This blog is my notebook from the journey.

About the author and PowerDoze →