Quick Links

On Windows, automatic sign-in is convenient because you can have your PC launch programs when it starts. You can even have your PC automatically boot at specific times. For improved security, you can have Windows 10 automatically lock itself and require a password after automatic sign-in.

How This Works

With automatic lock at sign-in, your PC will automatically sign in and launch and startup programs when it boots---but it will lock itself and you'll have to enter your password to use it. This isn't as secure as avoiding automatic sign-in as your user account password will still be stored and automatically entered by the system, but it's better than just having your PC automatically start and offer an unrestricted desktop.

To do this, all you have to do is make Windows run the following command when it signs in:

rundll32.exe user32.dll, LockWorkStation

This command will lock your system. It accomplishes the same function as pressing Windows+L. There are a variety of ways to make Windows run it at sign-in, including in Group Policy. However, the simplest way is just by adding a Lock shortcut to your Startup folder.

We performed this process on Windows 10, but it will also work on older versions of Windows including Windows 8 and Windows 7.

Related: How to Make Your PC Automatically Turn On on a Schedule

Creating the Lock Shortcut

First, open the Startup folder. To do so, press Windows+R to open the Run dialog, type the following line, and press Enter:

shell:startup

Opening the Startup folder on Windows 10.

In the Startup folder, right-click and select New > Shortcut.

Creating a new startup shortcut on Windows 10.

In the Create Shortcut dialog, copy-and-paste (or type) the following command:

rundll32.exe user32.dll, LockWorkStation

Click "Next" to continue.

Creating a shortcut that locks the computer on Windows 10.

Name the shortcut whatever you like---for example, "Lock Computer."

Naming a Windows shortcut "Lock Computer."

Related: How to Add a Program to Startup in Windows 10 or 11

That's It!

If you double-click the shortcut you created, Windows will lock your computer. You'll then have to sign in with your password, PIN, or whatever other sign-in method you use.

When you sign in to your PC, Windows will launch this shortcut along with your other startup programs, automatically locking your PC. After you unlock it, it'll be good to go.

To undo your change, just re-open the shell:startup folder and delete the Lock Computer shortcut you created.

Related: How to Make Your Windows 10, 8, or 7 PC Log In Automatically


Thanks to Mathew Locke for emailing us about this great tip.