9

I am looking for a program that automatically logs into Windows when I turn the computer on, and then locks it straight away.

ie: I turn my computer on > I am automatically logged in if there is inactivity for a few seconds > The computer is then locked (ie. Win + L).

Requirements:

  • free
  • only logs in if there is inactivity for a user-defined time (less than 3 or so minutes)
  • locks the computer, Windows style, not its own style
  • runs on Windows 7 64 bit

I'm sure every single person reading this has had at least one time where they turn their computer on, and go away for a few minutes (maybe the toilet? :) and you returned to see you didn't login! You then had to login and wait for a few minutes to make sure all the startup programs open and, finally (!) you could start doing whatever you wanted to!

This program will help be avoid what I said above. It will ensure that the programs that should open on login, start opening as soon as the computer turns on (rather than waiting for me to come back, enter my password, and wait 5 minutes for them to start).

  • What does "inactivity" mean? Mouse, keyboard, joystick, MIDI, attach a USB stick, ...? – Thomas Weller Jul 16 '16 at 8:59
  • @ThomasWeller basically when the computer is completely idle. no mouse movement, keyboard keys, peripherals being used – ᔕᖺᘎᕊ Jul 16 '16 at 14:56
  • 2
    Related: superuser.com/q/352616/35237 – Tobias Kienzler Dec 11 '17 at 9:04
  • @Tobias - that seems perfect! I'd be happy to mark that as an answer if you posted one! :) – ᔕᖺᘎᕊ Feb 24 '18 at 22:42
5

Do both the following:

  1. set up your account to auto-login: (below is quoted from that link)

    1. Click Start, type netplwiz, and then press Enter.
    2. In the User Accounts dialog box, click the account you want to automatically log on to.If it is available, clear the "Users Must Enter A User Name And Password To Use This Computer" check box.
    3. Click OK.
    4. In the Automatically Log On dialog box, enter the user’s password twice and click OK.

    This will start the Advanced User Accounts Access Panel, and allow you to switch on Windows' built-in auto-login function for that account. This is a built-in windows function, there isn't a time-out option to only initiate the login after a period of inactivity.

  2. With your favorite text editor, create a .cmd batch file (not .bat). The file name does not matter, I called mine autolock.cmd. The file should contain the following commands:

    timeout /t 10
    rundll32.exe user32.dll,LockWorkStation
    
  3. Move or copy it into your "All Users" startup folder. On Windows 8/10 you can easily navigate to the All Users startup folder in File Explorer by typing shell:common startup in the path field (the current user's startup folder is shell:startup).

Step 1 above logs you in automatically after every restart. The .cmd file then gets run a few seconds after login; it will wait for ten seconds, and then lock the workstation. If you don't want the lock to kick in, just press Ctrl+C to interrupt

  • Is there a Windows 10 alternative for this? – user2924019 Nov 6 '17 at 10:04
  • Updated to remove the dependency on 3rd party software. This can all be accomplished easily using native Windows commands. – Jim Garrison Mar 15 at 5:57
2

You should be able to use AutoHotkey (Free, open-source, Windows), something along the lines of:

Sleep, 60000  ; 60 seconds (change this depending on how long you want to wait)
Send #l       ; hold down the Windows key and then press the letter "l" -> lock Windows

compile the script into an EXE with ahk2exe and add it in startup.

  • 1
    Cool, but will this work before I login?? Or will I need to login and then this will work? Adding it to startup would mean after 60 seconds of being logged in, the computer will be locked – ᔕᖺᘎᕊ Jul 15 '14 at 15:52
  • 1
    You might want to see this. Apparently the AutoHotKey version you link to is out of date. Maybe that is why your answer on my minimizing question is not working? – ᔕᖺᘎᕊ Jul 15 '14 at 16:44
  • @ṧнʊß Yes it wouldn't get locked directly, but should be pretty quick if you get rid of the sleep. Thanks the link, I updated but still same issue :/ – Franck Dernoncourt Jul 15 '14 at 16:49
  • I meant I want to login automatically after a few minutes, and then lock immediately... – ᔕᖺᘎᕊ Jul 16 '14 at 10:35
  • Oh sorry, now I get it :) I'll leave the answer as it can be use as an alternative second step to energy number's answer, but yeah first step turn on auto login! – Franck Dernoncourt Jul 16 '14 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.