How to lock Windows PC after automatic login
On Windows, automatic log-in is handy because you can launch the PC program when it starts. You can even let your PC boot automatically at specific times. To improve security, you can let Windows 10 automatically lock and ask for a password after you sign in automatically.
How to lock Windows PC after automatic login
With auto-lock at sign-in, your PC will automatically log in, launch and start the program on boot - but it'll lock itself and you'll have to enter your password to use it. This is not as secure as avoiding automatic login, as your user account password will still be stored and entered automatically by the system, but it's better than having your PC start up and provision it automatically. an unrestricted desktop.
To do this, all you have to do is let Windows run the command after it's logged in:
rundll32.exe user32.dll, LockWorkStation
This command will lock the system. It accomplishes the same function as pressing Windows + L . There are several ways to get Windows to run it when logged in, including in Group Policy. The easiest way, however, is to simply add a key shortcut to your Startup folder .
I did this process on Windows 10, but it should also work on older versions of Windows, including Windows 8 and Windows 7.
Create key shortcuts
First, open the Startup folder. To do so, press Windows + R to open a Run dialog box , type the following line and press Enter :
shell:startup
In the Startup folder , right-click and choose New> Shortcut .

In the Create Shortcut dialog box , copy and paste (or type) the following command:
rundll32.exe user32.dll, LockWorkStation
Click Next to continue.
Name the shortcut whatever you like - for example, ' Lock Computer '.
All operations are completed!
If you double-click the created shortcut, Windows will lock the computer. You will then have to sign in with your password, PIN or any other login method you use.
When you log in to your PC, Windows launches this shortcut along with other startup programs and automatically locks your PC. After you unlock it, you should be able to do everything on the machine as you normally would.
To undo the change, just reopen the shell: startup folder and delete the Lock Computer shortcut you created.
You should read it
- How to make the Scroll Lock key useful on Windows 10 PC
- Fixed a bug with the Cap Lock key on Windows 10 suspended
- How to lock Windows 11 PC via Bluetooth connection with Dynamic Lock feature
- Summary of how to lock Windows 11 PC
- How to disable Lock Screen lock screen on Windows 8, 10
- How to enable the auto-lock feature when users leave - Dynamic Lock on Windows 10
- How to disable the Caps Lock key in Windows 10
- How to change screen lock timeout in Windows 10
- Remove Network icon on Lock Screen lock screen Windows 10
- Create a tone when pressing Caps Lock, Num Lock, or Scroll Lock Windows 10
- Some applications help customize the Windows Phone 8 lock screen
- How to turn on the search box on the lock screen on Windows 10
Maybe you are interested
10 facts about the dangerous and hard-to-kill German cockroach that is raging in Vietnamese apartments Link Download Microsoft Office 2019 How to reset PS5 to factory reset quickly Huawei was removed from the SD memory card association, will the future of SD memory card slot disappear on Huawei phones? Prepare Active Directory for Exchange 2007 (Part 2) Check Exchange 2007 with System Center Operations Manager 2007 - Part 2