Advertisements

How to Lock Your Windows 10 PC Using Command Prompt

Whenever you’re stepping away from your PC for some time, no matter how short; if you’re cybersecurity conscious, you’ll know that it is important to lock your PC. Doing that, among other things, gives you some level of assurance that your PC is protected from unsolicited access by scammers, phishers and the likes. There are several ways to lock your PC but in this article, the focus is on locking your Windows 10 PC using the Command Prompt.

How to Lock Your Windows 10 PC Using Command Prompt

It may not be the fastest method but at least it’s advantageous to have extra tricks in your hat – more than one way of doing the same thing.

Without further ado, let’s dive into the subject matter.

Locking your Windows 10 PC Using Command Prompt

To launch the Command Prompt, press the Windows key to open the start menu and type in “cmd” in the search bar. Select Command Prompt from the list of options that appear in the search results and run the application.

open command prompt

When Command Prompt opens, type in the following command:

Rundll32.exe user32.dll,LockWorkStation

Hit the enter key to execute the command and lock your PC.

When your PC is locked, the lock screen will usually stay on for some time before it times out. You can also determine the lock screen timeout using Command Prompt so that in cases when you have to hurriedly leave your workstation after locking your PC, you can be sure that the lock screen will go off after some time you set.

Advertisements

Let’s quickly see how you can do that.

Setting Lock Screen Timeout Using Command Prompt

Launch Command Prompt the same way as in the first instance but this time, make sure that you run the application as an administrator to avoid any complications. To do that simply right click on “Command Prompt” when it appears on the search results and then select “Run as administrator”.

Launch Command Prompt on Windows 10

Advertisements

When Command Prompt opens, type in the following command:

powercfg.exe /SETACVALUEINDEX SCHEME_CURRENT SUB_VIDEO VIDEOCONLOCK <time>

In place of <time>, slot in your preferred time out duration in seconds, i.e, if you’re looking to set a lock screen timeout duration of 1 minute, an equivalent of 60 seconds, your command should look like this:

powercfg.exe /SETACVALUEINDEX SCHEME_CURRENT SUB_VIDEO VIDEOCONLOCK <60>

Note that the command above is valid only when your PC is plugged in and charging. If it’s running on battery power, the command will be invalid. What you need to do to be able to set the lock screen timeout when your PC is on battery power is to change /SETACVALUEINDEX to/SETDCVALUEINDEX and run the command as normal.

Then proceed to run this command:

powercfg.exe /SETACTIVE SCHEME_CURRENT

That’s all there is to it. You now know how to lock your Windows 10 PC using Command Prompt and even, as a bonus, how to set the lock screen timeout also using Command Prompt.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.