Windows has several independent mechanisms that control when a machine sleeps. Most guides tell you to change one setting and call it done. The problem is that there are at least five different ways sleep can kick in, and disabling one doesn't always stop the others.

This guide covers every method — from the built-in Settings UI to a one-command PowerShell override — and explains which one is right depending on whether you need the machine awake for the next two hours or the next two months.

Temporary vs. Permanent: The Question No Guide Asks

Before picking a method, answer one question: do you need the machine awake right now, or always?

These are genuinely different requirements that call for different solutions. Most guides treat them as the same problem and tell you to change a setting permanently — which works, but has real downsides when your laptop is running on battery or you forget to restore the setting before a presentation in a dark room where the screen is the only light.

Don't permanently disable sleep for temporary needs

The most common mistake is opening Settings, setting sleep to "Never," solving the immediate problem, and forgetting to change it back. On a laptop, this drains battery faster, shortens display backlight life, and means the machine never enters low-power states when idle. Use a tray app or timed command if you only need this occasionally.

Five Methods at a Glance

Method Temporary? Effort Reversible
SmartSleep (tray app) Yes Install once, click One click
Windows Settings No — permanent 3 clicks Manual reset needed
powercfg / PowerShell Optional Command line Session-scoped
PowerToys Awake Yes Install 20MB suite Yes
Caffeine / Don't Sleep Yes Small install Yes

Method 1: Vexifa SmartSleep (Recommended for Temporary Use)

How it works: SmartSleep calls Windows' SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED) API. This is the same mechanism Windows uses internally to prevent sleep during video playback, during presentation mode, and when an application is doing full-screen work. It doesn't change any system settings — it signals to the power manager that the current session requires the display and system to stay awake.

When you disable SmartSleep (or close it), the wake lock is released and Windows resumes normal power management immediately. There's nothing to undo, no settings to reset, no system state left behind.

Where to get it

Vexifa SmartSleep is free on the Microsoft Store. Install takes under a minute. No account required.

Method 2: Windows Settings (Best for Permanent Changes)

Built-in

Windows Power Settings

No install required · Permanent change until manually reverted

The simplest approach for machines that should permanently stay awake (servers, media centers, desktop workstations):

  1. Open Settings (Win + I)
  2. Go to System → Power & sleep (Windows 10) or System → Power (Windows 11)
  3. Under Sleep, set both "On battery power" and "When plugged in" to Never
  4. Optionally, set Screen to Never as well — this controls the display, sleep controls the system

On Windows 11, the path is slightly different: Settings → System → Power & battery → Screen and sleep. The setting names are the same.

This doesn't cover lid close on laptops

Power settings control timeout-based sleep but not lid-triggered sleep. To change what happens when you close the lid, search "lid" in Settings or go to Control Panel → Power Options → Choose what closing the lid does and set it to Do nothing.

Method 3: powercfg Commands (Best for Scripting)

Command Line

powercfg / PowerShell API

No install required · Scriptable · Good for automation workflows

Windows' powercfg utility modifies power plans from the command line. Run Command Prompt or PowerShell as Administrator.

Disable sleep via powercfg (permanent until reversed):

rem Disable sleep on AC power powercfg /change standby-timeout-ac 0 rem Disable sleep on battery powercfg /change standby-timeout-dc 0 rem Disable display timeout on AC powercfg /change monitor-timeout-ac 0

To restore defaults (30 minutes on AC, 10 minutes on battery):

powercfg /change standby-timeout-ac 30 powercfg /change standby-timeout-dc 10

Temporary override via PowerShell (lasts until the PowerShell window is closed):

Add-Type -TypeDefinition @' using System; using System.Runtime.InteropServices; public class SleepBlock { [DllImport("kernel32.dll")] public static extern uint SetThreadExecutionState(uint flags); public const uint ES_CONTINUOUS = 0x80000000; public const uint ES_SYSTEM_REQUIRED = 0x00000001; public const uint ES_DISPLAY_REQUIRED = 0x00000002; } '@ [SleepBlock]::SetThreadExecutionState( [SleepBlock]::ES_CONTINUOUS -bor [SleepBlock]::ES_SYSTEM_REQUIRED -bor [SleepBlock]::ES_DISPLAY_REQUIRED ) Read-Host "Press Enter to release sleep lock"

Run this in an elevated PowerShell window. The lock releases when you press Enter or close the window. This is exactly what SmartSleep does under the hood — with a tray icon and toggle instead of a terminal window.

Diagnose what's causing unexpected sleep:

rem Show what programs are requesting sleep/display on powercfg /requests rem Generate a full sleep study report (opens HTML file) powercfg /sleepstudy

Method 4: PowerToys Awake (Overkill for Most)

Large install

Microsoft PowerToys — Awake module

20MB+ installer · Timed or indefinite modes · Made by Microsoft

PowerToys is a free Microsoft utility suite that includes a module called Awake specifically for preventing sleep. It supports timed durations (stay awake for 1 hour, 2 hours, etc.) and indefinite mode, with a small tray icon.

The functionality is identical to SmartSleep. The difference is the footprint: PowerToys is a full developer utility suite (keyboard remapper, window manager, color picker, file renamer, OCR tool, and about 20 other utilities). The installer is 20–25MB and installs background services for all modules, not just Awake.

If you already use PowerToys for other features, Awake is a good bonus. If you're installing PowerToys only to prevent sleep, you're installing an entire platform just to run one 2MB function. SmartSleep or the PowerShell method above does the same job.

Get it: learn.microsoft.com/en-us/windows/powertoys/ — free, from Microsoft.

Method 5: Caffeine / Don't Sleep (Third-Party Tray Apps)

Lightweight

Caffeine / Don't Sleep

Very small footprint · No installer needed for Caffeine · Long-standing freeware

Caffeine (by Zhorn Software) is a 92KB executable that simulates an F15 keypress every 59 seconds to prevent the screen saver and sleep from triggering. This is a hack rather than an API-level solution — it works by making Windows think there's keyboard activity, which is less clean than using the SetThreadExecutionState API but works on machines where that API is restricted by policy.

Don't Sleep (by SoftwareOK) uses the proper API approach, has a more detailed UI with scheduled modes, and is still actively maintained. It's a reasonable alternative to SmartSleep with a slightly more complex interface.

Both tools are legitimate freeware that have been around for over a decade. The main reason to choose SmartSleep over them is the Microsoft Store delivery model — automatic updates, signature verification, and no need to track third-party download pages for updates.

The Downsides of Keeping Your Machine Awake

Every guide on this topic stops at "how to do it." Few explain why you might not want to do it all the time.

These aren't reasons not to prevent sleep — they're reasons to prevent it intentionally and temporarily rather than permanently as a default.

Still Sleeping? How to Diagnose It

If you've changed your power settings and the machine is still sleeping, something else is overriding them. Common causes:

Group Policy override (work machines)

IT administrators can enforce power settings via Group Policy that override anything in the personal Settings UI. You'll see this when your settings appear correct but the machine still sleeps. Run rsop.msc (Resultant Set of Policy) and check the Computer Configuration → Administrative Templates → System → Power Management section. If there are configured policies, your IT department controls this — SmartSleep's API approach may still work since it signals at the session level rather than through the power plan.

Driver-triggered sleep

Some drivers (particularly older display drivers and network adapters configured for wake-on-LAN) can trigger sleep events independently. Run powercfg /lastwake in an elevated Command Prompt to see what triggered the most recent wake event, and powercfg /sleepstudy for a full event history.

Lid sensor (laptops)

If the laptop lid sensor is misbehaving or the lid is physically depressing the sensor slightly when closed, the system may interpret this as a lid-close event. Check Control Panel → Hardware and Sound → Power Options → Choose what closing the lid does and confirm it's set to Do nothing.

Modern Standby (S0 sleep)

Many modern laptops use S0 Modern Standby instead of traditional S3 sleep. In Modern Standby, the machine appears to be off but is actually in a low-power networked state — which can cause issues where the machine "wakes up" and performs background tasks. This is expected behavior, not a bug. Check which sleep state your machine supports: powercfg /a.

Frequently Asked Questions

How do I stop my Windows laptop from going to sleep?

The quickest way is Settings → System → Power & sleep → set "When plugged in, PC goes to sleep after" to Never. For a temporary solution without permanently changing settings, use Vexifa SmartSleep (free, system tray app from the Microsoft Store) or run powercfg /requests to diagnose what's overriding your settings.

Is it bad to keep your laptop awake all the time?

For laptops, permanently disabling sleep has real downsides: the battery drains faster on battery power, the machine runs hotter, and the display backlight ages faster. For desktops, the concern is mainly energy waste. A better approach is to disable sleep only when you need to — during a presentation, download, or long-running process — and let the machine sleep normally the rest of the time. Tools like SmartSleep are designed for this: they prevent sleep while active and restore your normal settings when dismissed.

What is the powercfg command to prevent sleep?

Run powercfg /change standby-timeout-ac 0 in an elevated Command Prompt to disable sleep on AC power. Use powercfg /change standby-timeout-dc 0 for battery. To restore defaults, replace 0 with 30 (minutes). For a temporary session-scoped approach without changing settings, use the PowerShell SetThreadExecutionState method described above.

Does PowerToys Awake prevent sleep on Windows?

Yes, PowerToys Awake is a built-in PowerToys utility that prevents Windows from sleeping. It supports timed durations and indefinite mode. The downside is that PowerToys is a 20MB+ suite installation — you're installing an entire collection of developer utilities just to get one sleep-prevention feature. If you only need the sleep prevention, Vexifa SmartSleep is a smaller dedicated app that does the same job without the overhead.

Why does my Windows laptop keep sleeping even after I change power settings?

Three common causes: (1) A Group Policy override set by IT administration on a work machine — these override personal power settings. Run rsop.msc to check. (2) A driver or system service is triggering sleep independently. Run powercfg /sleepstudy to see a full event log. (3) The laptop lid sensor is triggering a lid-close sleep event — check Control Panel → Power Options → Choose what closing the lid does.