Automatically lock Windows 10 PC via command prompt

Whenever you move away from your PC, it may be important to lock your PC. Especially when sensitive data is present, it is necessary to lock the PC as soon as possible by using a lock screen.


There are several ways to lock your PC. Besides "Windows+ L-key" you can also lock a Windows 10 PC via the command prompt.

Lock your Windows 10 PC via command prompt - set timeout

To start the command prompt, press the Windows key to open the Start menu and type "cmd" in the search bar. Select "Command Prompt" from the list of options that appear in the search results.

When the command prompt appears, type the following command:


Instead of <Time> enter your preferred timeout duration in seconds. For example 120 seconds for 2 minutes:


The above command via the command prompt only works if you have connected your device via a power supply. The command is not executed in battery mode.

If the time period is now exceeded, the lock screen is automatically activated and Windows 10 is locked. So you are safe on the road.


About the Author

Manuel Solvemix Team small

Manuel has been involved with technology for more than 15 years, especially with mobile phones, smartphones and PC systems and shares his passion here in this blog. If he can help someone with a technical problem, he is especially happy about it.