Batch file for starting Windows 7 with the numeric keypad

davfor1 Posted messages 3 Status Member -  
Cirdek Posted messages 22 Status Member -
Bonjour,

I want to create a batch file that starts at Windows startup, asking the user whether they want to enable the numeric keypad or not.

Can you tell me how to make a .bat or .cmd file to execute this command on Windows startup and give the user a choice?

Thank you

David

2 answers

  1. Cirdek Posted messages 22 Status Member 15
     
    In batch :
    @echo off :: Executes commands as administrator :------------------------------------- REM --> Permission verification >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" REM --> Error you do not have admin rights if '%errorlevel%' NEQ '0' ( echo Verifying administrator privileges goto UACPrompt ) else ( goto gotAdmin ) :UACPrompt echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" set params = %*:"=" echo UAC.ShellExecute "%~s0", "%params%", "", "runas", 1 >> "%temp%\getadmin.vbs" "%temp%\getadmin.vbs" exit /B :gotAdmin if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" ) pushd "%CD%" CD /D "%~dp0" :-------------------------------------- for /f "usebackq" %%f in ( `mshta "javascript:new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1).Write(new ActiveXObject('WScript.Shell').PopUp('Do you want to start with Num Lock enabled?',0,'Enable/Disable Num Lock',35));close();"` ) do ( if "%%f"=="6" ( reg add "HKEY_USERS\.DEFAULT\Control Panel\Keyboard" /v InitialKeyboardIndicators /t REG_SZ /d 2 /f rem YES ) else if "%%f"=="7" ( reg add "HKEY_USERS\.DEFAULT\Control Panel\Keyboard" /v InitialKeyboardIndicators /t REG_SZ /d 1 /f rem NO exit ) else ( exit ) ) 

    0 = Num Lock is turned OFF after the logon.
    1 = Disable Num Lock.
    2 = Num Lock is turned ON after the logon.

    Tested quickly... To encode in OEM 720 under Notepad++ for example.
    2
  2. CorentinRoche Posted messages 287 Status Member 41
     
    Hello, If I understood correctly, you want your script to run automatically when your PC starts?

    Best regards
    Roche Corentin
    0