Batch Archive [Version 2.1.0001]
Copyright (c) 2018 TheHacker. All Rights Reserved

C:\Users\TheHacker>

Read Mode
Default

Batch Script to Lock Computer | How to Lock PC From Notepad / CMD?

Lock Computer with CMD: Although You can automate many operations regarding system log-on - using the Shutdown command in CMD. But, One of the most essential requirements of Locking The System out is not provided in the pack. So, Directly there is no command to simply LOCK Computer. So, it is very difficult to make a batch file to lock computer windows. But, You can do the trick - combining few commands. Let's have a look.
 What is CMD Actually? | Batch Basics | By Gls
Batch Script to Lock Computer | How to Lock PC From Notepad / CMD?
Batch Script to Lock Computer | How to Lock PC From Notepad / CMD? | Windows 10 Lock Screen

How to Lock PC From Notepad / CMD?

You need to Use the utility that comes with the windows by default (inbuilt command) Called, "Rundll32.exe". And, Provide another utility that comes with windows - "User32.dll". You will find both these files in the "C:\Windows\system32" Folder. Just Provide the 'LockWorkStation' Command from the dll. And, As you'll press Enter. (or execute it in your Batch File) You'll find your PC will be locked. The Command ...
Rundll32.exe user32.dll LockWorkStation

 Alternative Methods

Batch Script to Lock Computer | How to Lock PC From Notepad / CMD?
Batch Script to Lock Computer | How to Lock PC From Notepad / CMD?
Although, you can get the same thing with many other methods which allows you to send the combination of Keys as Windows+L. But, that will require multiple steps (and also note that - VBS don't allow to simply send the Windows Key) So, we still think - This method is little hard to learn - but, it good and easy to use for the batch programmers.
 Must Read: Mouse Buttons Swapping by Batch Scripting

From Editor's Desk

What do you think about this method of Locking your PC via CMD? If you have an any better method or you want to share your way of achieving this faster and efficiently in Windows. Please Feel free to ask or share your thoughts in the comments. We'll really like to read them. 

You can also share your work in the field of Batch programming to publish on this Batch blog. We'll publish it on the blog with your name. Thanks for faith and time. We'll see you in the next article.

Keep Learning, Keep Sharing...
Be Happy, Spread Happiness...

No comments:

Powered by Blogger.