To prevent your Windows system from automatically logging off after inactivity, you can adjust the power and sleep settings. Here's how you can do it:
Using Power Options:
a. Press Win + X and select "Power Options" from the menu.
b. In the Power Options window, find your current power plan (usually "Balanced" or "Power Saver") and click on "Change plan settings" next to it.
c. Under "Turn off the display" and "Put the computer to sleep," set both options to a higher value or choose "Never" from the drop-down menu.
d. Click on "Change advanced power settings" to open the advanced settings.
e. In the Advanced settings, look for "Sleep" and expand it. Set "Sleep after" and "Hibernate after" to a value you prefer or set both to "Never."
f. Click "Apply" and then "OK" to save the changes.