Guide:How to Lock Your Windows 10 PC Using Command Prompt


Windows 10 Logo

One of the first rules of cyber security is to always lock your PC before stepping away. While it may not be the quickest way to lock your Windows 10 PC, you can do it using the Command Prompt.

Lock Your Windows 10 PC Using Command Prompt

First, open the Command Prompt on your PC by opening the “Start” menu, typing “cmd” in the Windows Search bar, and then selecting “Command Prompt” from the search results.

Open Command Prompt from Windows Search

Command Prompt will now open. Here, run this command to lock your Windows 10 PC.

Rundll32.exe user32.dll,LockWorkStation

Command for locking your Windows 10 PC

Once executed, your PC will be locked. You’ll have to sign back in with your PIN, password, or whatever sign-in method you usually use.

Set the Lock Screen Timeout Setting Using Command Prompt

Once you’ve locked your PC, the lock screen will generally be displayed for a certain amount of time before it time outs. You can set the amount of time that needs to pass before timing out using the Command Prompt.

To do this, you’ll need to open Command Prompt as an admin. Do so by typing “cmd” in the Windows Search bar and then right-clicking “Command Prompt” from the results. Next, select “Run As Administrator” from the menu that appears.

Open Command Prompt as an Admin

With Command Prompt open, run this command.


Replace <time> with your desired amount of time in seconds. That means if you want to time out the lock screen after two minutes, you’d enter this command:


command for setting the lock screen timeout timer

Note: This command sets the lock screen timeout setting for your PC if it’s plugged up to a power source. To set the lock screen timeout setting for your PC if it’s running on battery, change/SETACVALUEINDEXto/SETDCVALUEINDEX and run the command as normal.

Next, run this command:


Final command for setting lock screen timer

Now your lock screen will timeout after the set amount of time. Give it a try!

If you think this post can be helpful to somebody else, please share it on Twitter, Facebook or Whatsapp it to friends. There are buttons below for this (easy to use too)! Join Over 5,000 + Readers. Get a free daily update via Email HERE

For the latest tech news across the world, latest PC and Mobile games, tips & tricks, top-notch gadget reviews of most exciting releases follow Naijatechnews' FacebookTwitter, Instagram & Telegram. Subscribe our Google News, & YouTube Cannel.

DOWNLOAD Our Mobile App

Get real time updates directly on you device, subscribe now.


This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Privacy & Cookies Policy