How to Lock Computer Using Command Prompt?

 In Windows 10 Lock Option is used to Lock your computer to Protect your work. Locking your computer keeps your files safe while you are away from your computer. Locking your computer is always a good habit to follow, A locked computer hides and protects programs and documents, and will allow only the person who locked the computer to unlock it again. To lock a windows computer, you have to press and hold the Windows Logo key on your keyboard and press the L key. This key combination will lock your computer. Windows + L Another way to Lock your computer is from the start menu you can click on the start menu and click on the Profile Picture; there you can see the Lock option. Clicking on this Lock Option will Lock your computer immediately. In this article, we are going to use a different method to Lock the computer. This article will guide you to Lock Computer Using Command Prompt in Windows 10.

Lock Computer Using Command Prompt:

Open Command Prompt in Elevated Mode. After Opening the Command Prompt window, type the below-mentioned command, and hit enter.

Rundll32.exe user32.dll,LockWorkStation

Lock Computer Using Command

Copy-paste the above-mentioned command in Command Prompt window. Once you execute the command the computer will Lock automatically. Then you need to type a password or PIN to log in to the system.

Create a Batch File:

You can create a batch file using the same command, using the batch file you can lock your computer by click on it.

Open Notepad and copy-paste the following code.

@ECHO OFF Rundll32.exe user32.dll,LockWorkStation PAUSE

Now save the Notepad file as LockComputer.bat.

Now Double click on the LockComputer batch file it will Lock the computer immediately.

 

Leave a Comment

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.

Scroll to Top