Now execute the below command to disable the login screen when the laptop is charging powercfg /SETACVALUEINDEX SCHEME_CURRENT SUB_NONE CONSOLELOCK 0.
Then type in the below command to disable the login screen when the PC is on battery powercfg /SETDCVALUEINDEX SCHEME_CURRENT SUB_NONE CONSOLELOCK 0.
To begin with, head over to the Start Menu, search CMD, and launch Command Prompt as an administrator.
For best results, you should execute both these commands. The first command will disable the login screen when your laptop is running on battery whereas the second command will do so when your laptop is charging. In this method, you just have to execute a couple of commands in the Command Prompt and your task stands complete.