First, open Windows Settings by pressing Windows+i on your keyboard. Or you can right-click the Start button and select “Settings.”
In Settings, click the search bar and type “lid,” then click the “Change what closing the lid does” result that appears beneath it.
A “System Settings” window will open (this is part of Control Panel, which is the legacy setup program for Windows.) Under “Power and sleep buttons and lid settings,” you’ll see several options that let you choose what happens when you press the power or sleep buttons on your device.
Near the bottom, you’ll see “When I Close the Lid.” If you want your laptop to stay awake while not plugged in (and on battery power only), choose “Do Nothing” under the “On Battery” column. If you want your laptop to stay awake with the lid closed only while plugged in, use the drop-down menu in the “Plugged In” column and select “Do Nothing.”
Warning: If you allow your laptop to stay powered on with the lid closed while on battery power, you may accidentally run down your battery without realizing it, so be careful.
After that, click the “Save Changes” button at the bottom of the window.
These changes will apply to all of your power plans. When you’re ready, close the “System Settings” and “Settings” windows. To test it out, plug your laptop into an external monitor and close the lid. If the video stays on, you’ll know that you configured it properly. Good luck!