Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Windows (http://www.go4expert.com/articles/windows/)
-   -   Control Startup Numlock Status to On/Off (http://www.go4expert.com/articles/control-startup-numlock-status-t4351/)

pradeep 18May2007 00:27

Control Startup Numlock Status to On/Off
 
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.

Code: VB

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



All times are GMT +5.5. The time now is 23:25.