1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Control Startup Numlock Status to On/Off

Discussion in 'Windows' started by pradeep, May 17, 2007.

  1. pradeep

    pradeep Team Leader

    Apr 4, 2005
    Likes Received:
    Trophy Points:
    Kolkata, India
    Home Page:
    If you want Numlock to stay On or Off at startup, you can do that with a registry edit.

    Navigate to HKEY_CURRENT_USER\Control Panel\Keyboard\InitialKeyboardIndicators and the change the value to 0 if you want Numlock enabled at starup, and 2 to have it enabled at startup.

    Alternatively, you can use the VB ShellScript below to do the work for you.

    Option Explicit
      On Error Resume Next
      Dim WSHShell, n, rK, itemtype, MyBox, vbdefaultbutton
      Set WSHShell = WScript.CreateObject("WScript.Shell")
      rK = "HKEY_CURRENT_USER\Control Panel\Keyboard\InitialKeyboardIndicators"
      itemtype = "REG_SZ"
      n = WSHShell.RegRead (rK)
      errnum = Err.Number
      if errnum <> 0 then
          WSHShell.RegWrite rK, 2, itemtype
      End If
      If n = 0 Then
         WshShell.RegWrite rK, 2, itemtype
         MyBox = MsgBox("Numlock is now ENABLED", 64, "Enable Numlock")
      End If
      If n = 2 Then 
         WshShell.Regwrite rK, 0, itemtype
         MyBox = MsgBox("Numlock is now DISABLED", 64, "Enable Numlock")
      End If
      Set WshShell = Nothing

Share This Page