Forum Discussion

Boboin's avatar
Boboin
Iron Contributor
Apr 02, 2026

Windows 10 Lock session with power button like Linux

Can I press the power button to lock my screen instead of shutting down, just like Linux? Win+L doesn’t work for me.

 

3 Replies

  • MateoSmith's avatar
    MateoSmith
    Silver Contributor

    In Control Panel > Power Options > Choose what the power buttons do, set When I press the power button to Lock

  • JaydenFlash's avatar
    JaydenFlash
    Copper Contributor

    In Control Panel > Power Options > Choose what the power buttons do, set When the power button is pressed to Lock.

  • mohdadeeb's avatar
    mohdadeeb
    Iron Contributor

    Yes, you can change what the power button does in Windows 10, but unfortunately there isn’t a direct option to make it lock the screen like in Linux. What you can do instead is change the action to Sleep or Turn off the display, which will require you to sign in again when you wake the system.

    To change it:
    Go to Control Panel → Hardware and Sound → Power Options → Choose what the power buttons do. Then change “When I press the power button” from Shut down to Sleep or Turn off the display and save the settings.

    Another small trick is creating a shortcut that locks the PC. Create a new desktop shortcut and use this command:

    rundll32.exe user32.dll,LockWorkStation

    Clicking that shortcut will instantly lock your session.