none
Reg Add problem. Convert from .reg to reg add script RRS feed

  • Question

  • Hi. I'm making a registry script so I can add elements to the registry.

    The script is working for DWORDS but I cant get the last one to work.

    The registry exportet code I wan't to make a Reg ADD line from is:

    [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\BrowserEmulation\ClearableListData]
    "UserFilter"=hex:41,1f,00,00,53,08,ad,ba,01,00,00,00,2c,00,00,00,01,00,00,00,\
      01,00,00,00,0c,00,00,00,9c,26,40,27,0c,f5,cf,01,01,00,00,00,07,00,6e,00,69,\
      00,74,00,6f,00,2e,00,6e,00,6f,00


    I've tried to google and have tried several reg ADD lines, but should't it be something like this?

    reg ADD "hku\temp\Software\Microsoft\Internet Explorer\BrowserEmulation\ClearableListData" /v UserFilter /t REG_BINARY /d 
    
    41,1f,00,00,53,08,ad,ba,01,00,00,00,2c,00,00,00,01,00,00,00,\ 
    
    01,00,00,00,0c,00,00,00,9c,26,40,27,0c,f5,cf,01,01,00,00,00,07,00,6e,00,69,\ 00,74,00,6f,00,2e,00,6e,00,6f,00 /f

    Its the "\" that's get messy, don't know how to write reg Add line with that.

    If I skip that line the script works, I can then run the .reg file above to complete the reg. settings, but that won't solve my problem.

    Tuesday, November 11, 2014 2:47 PM

Answers

All replies

  • Rather than converting the registry data, leave it as it is and use regedit.exe to import it.

    regedit MyFile.reg

    Windows Registry Editor Version 5.00
    [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\BrowserEmulation\Test]
    "UserFilter"=hex:41,1f,00,00,53,08,ad,ba,01,00,00,00,2c,00,00,00,01,00,00,00,\
      01,00,00,00,0c,00,00,00,9c,26,40,27,0c,f5,cf,01,01,00,00,00,07,00,6e,00,69,\
      00,74,00,6f,00,2e,00,6e,00,6f,00


    Note also that this is a question about regedit.exe (or reg.exe). It is not a scripting (=programming) question. Have a look at the other posts in this forum to see what a script consists of.
    Tuesday, November 11, 2014 3:43 PM
  • Those backslashes just indicate line continuations in the .reg file.  You don't need them in your reg add version; the binary data can be placed all on one line.

    If I remember correctly, you don't need the commas when using "reg add" either, so just this should work.  I've used environment variables here to split it up across multiple lines and make it more readable, but that's not actually required:

    set REGKEY="hku\temp\Software\Microsoft\Internet Explorer\BrowserEmulation\ClearableListData"
    set REGDATA=411f00005308adba010000002c00000001000000010000000c0000009c2640270cf5cf010100000007006e00690074006f002e006e006f00
    
    reg add %REGKEY% /v UserFilter /t REG_BINARY /d %REGDATA%

    Tuesday, November 11, 2014 4:17 PM
  • I don't recommend blindly setting this kind of registry data without knowing what all of the bits stand for. There may be some peculiar consequences.

    -- Bill Stewart [Bill_Stewart]

    Tuesday, November 11, 2014 6:04 PM
    Moderator
  • This has been asked before. Microsoft has not provided a scriptable API for modifying the list of sites for compatibility view in IE. Sites can be added using a GPO (ask in Group Policy forum).


    -- Bill Stewart [Bill_Stewart]

    Wednesday, November 12, 2014 3:42 PM
    Moderator