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.

Also Read

Download Dolby Audio Driver for Windows 11/10/8.1

How To Fix External Hard Drive I/O Device Error in Windows 11/10

Fix: Win+Shift+S Not Working on Windows 11/10

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.

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.

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”.

How To Fix PowerShell Not Working Problem

Advertisement

When Command Prompt opens, type in the following command:

powercfg.exe /SETACVALUEINDEX SCHEME_CURRENT SUB_VIDEO VIDEOCONLOCK

In place of

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.