Search code examples
windowsbatch-fileregistry

Change registry using command line


I am trying to change registry using command line. Basically by executing the batch or .reg file. I have to change "Shell" value for:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon

I have tried "regini.exe" command as discribed on https://support.microsoft.com/en-us/kb/310516 but its not working for me. I have also tried:

reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon /v Shell /t Reg_Sz /d abcd.exe

but still no success.


Solution

  • Don't forget to backup your registry first !

    You can use:
    REG ADD [ROOT\]RegKey /v ValueName [/t DataType] [/S Separator] [/d Data] [/f]

    in your batch to change/add registry keys. So it would be:

    @echo off
    reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d "abcd.exe" /f
    pause
    

    For more details refer to: http://ss64.com/nt/reg.html