Can numlock condition be triggered by who logs in?


  1. Posts : 3
    Windows 10
       #1

    Can numlock condition be triggered by who logs in?


    I share this computer with another in my household, she likes the numlock to be in the on condition and I like it off. We are set up to have separate user accounts. Is there some way to have the numlock condition be set automatically when the login itself occurs? Some sort of batchfile that automatically executes when the login is successful? That way when we switch back and forth between user accounts so would the numlock state. (Windows 10 home version 21H2, build 19044.2006)
      My Computer


  2. Posts : 14,022
    Win10 Pro and Home, Win11 Pro and Home, Win7, Linux Mint
       #2

    There is a way to have NumLock as desired, it's a Registry entry that simply restores the setting at startup, retains the state it was in when shutdown or rebooted. If it's off it will come back as off, on comes back as on. It works on Desktops with the keyboard that has the Number pad on it and on Notebooks that have the Number pad, haven't needed to try on other Notebooks that use a different setup. For Notebooks having the added Number pad, they usually are 15.6" and 17". I have a Bluetooth Number Pad for use on my smaller Notebooks but the Registry tweak doesn't work with it.

    Check the Tutorials here:
    https://www.tenforums.com/gtsearch.p...&sa.x=0&sa.y=0
      My Computers


  3. Posts : 1,767
    Windows 10 Pro (+ Windows 10 Home VMs for testing)
       #3

    hollerg said:
    Is there some way to have the numlock condition be set automatically when the login itself occurs? Some sort of batchfile that automatically executes when the login is successful? That way when we switch back and forth between user accounts so would the numlock state. (Windows 10 home version 21H2, build 19044.2006)
    If you install AutoHotkey then you can use one of its commands - SetNumLockState - in a one-line AHK file stored in each of your accounts' startup folder.

    1. Download and install AutoHotkey using its defaults.

    2. For your wife, copy/paste the following one-line command into Notepad then save as numlock_on.ahk (not numlock_on.ahk.txt):
    Code:
    SetNumLockState, On

    3. For you, copy/paste the following one-line command into Notepad then save as numlock_off.ahk (not numlock_off.ahk.txt):
    Code:
    SetNumLockState, Off

    (Alternatively, just use the two AHK files in this attached SetNumlock.zip file.)

    4. Copy the numlock_on.ahk file into the startup folder of your wife's account/profile.

    5. Copy the numlock_off.ahk file into the startup folder of your account/profile.

    The easiest way I know of opening each 'per user' startup folder is to sign in to Windows then press Win key+R (to open a Run dialog) then enter shell:startup. File Explorer will automatically open the account profile's startup folder.

    Note: Instead of storing an AHK file in each respective startup folder you could instead store them both somewhere else (I always create a C:\Support folder for this purpose) then in each startup folder create a shortcut pointing to the appropriate AHK file.

    As you may have already guessed, when each of you sign in to your respective accounts, the one-line command in the AHK file will be run, changing the NumLock status to each of your preferences.

    Hope this helps...
      My Computer


  4. Posts : 3
    Windows 10
    Thread Starter
       #4

    Rick C that looks like just the ticket for what I need.

    tyvm
      My Computer


  5. Posts : 1,211
    Windows 10
       #5

    oof that way seems convoluted for something that can be handled natively. Berton has the right the idea.
      My Computer


  6. Posts : 23,281
    Win 10 Home ♦♦♦19045.4355 (x64) [22H2]
       #6

    @hollerg


    There's usually a BIOS setting (on the Boot tab). But this will work for ALL users.

    Can numlock condition be triggered by who logs in?-image1.png
      My Computer


  7. Posts : 1,767
    Windows 10 Pro (+ Windows 10 Home VMs for testing)
       #7

    Malneb said:
    oof that way seems convoluted for something that can be handled natively. Berton has the right the idea.
    The thing is... 'per user' NumLock states cannot be handled natively, hence the OP's request.

    The method Berton describes just remembers/reuses the last NumLock state, not a way to toggle between the preferences of different users.... which was what was asked for by the OP.
      My Computer


  8. Posts : 1,211
    Windows 10
       #8

    The reg key is on a per user basis though as its a child of HKEY_USERS
    Computer\HKEY_USERS\.DEFAULT\Control Panel\Keyboard

    Meaning they can be set according per user.
    .DEFAULT is not correct but i am the only user on this computer you would have to append the proper SID's in OP's case
      My Computer


  9. Posts : 3
    Windows 10
    Thread Starter
       #9

    Found a registry method


    Malneb inspired me to determine setting a USER's preferred numlock condition in the registry. Thankfully it was not too derivative for someone who knows only enough to be dangerous.

    1) Be logged in as the USER of interest.
    2) In Regedit, one goes to Computer\HKEY_USERS\ and inspects each listed ENVIRONMENT subkey (other than .DEFAULT) to locate the subkey that applies to the user: Computer\HKEY_USERS\S-1-5-21-246...\ (in my case)
    3) Go to Computer\HKEY_USERS\S-1-5-21-246... (in my case)\Control Panel\Keyboard and set the (Default) value to 1 for a Numlock off state.

    NOTE: I do see that registry value InitialKeyboardIndicators, just under (Default), has changed from 1 to 2 without any direct change by me. I do not know the significance of that. Thoughts as to what that means to how the software operates?
      My Computer


  10. Posts : 1,767
    Windows 10 Pro (+ Windows 10 Home VMs for testing)
       #10

    hollerg said:
    Malneb inspired me to determine setting a USER's preferred numlock condition in the registry.

    1) Be logged in as the USER of interest.
    2) In Regedit, one goes to Computer\HKEY_USERS\ and inspects each listed ENVIRONMENT subfolder (other than .DEFAULT) to locate the subfolder that applies to the user: Computer\HKEY_USERS\S-1-5-21-246...\ (in my case)
    3) Go to Computer\HKEY_USERS\S-1-5-21-246... (in my case)\Control Panel\Keyboard and set the (Default) to 1 for a Numlock off state.

    NOTE: I do see that registry entry InitialKeyboardIndicators, just under (Default), has changed from 1 to 2 without any change by me. I do not know the significance of that. Any thoughts on that?
    Yes, you can do it the way that @Malneb suggested, although IMO it takes longer/more steps.

    To work out each user profile's SID, open an elevated command prompt and enter the following command:
    Code:
    wmic useraccount get name,sid

    This will show you the correlation between user accounts and SIDs. I just offered what I thought was a quicker method (which also allows for further 'per user' customisation very easily.)

    Hope this helps...
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 08:33.
Find Us




Windows 10 Forums