none
REG ADD not creating (Default) (value not set) key properly

    Question

  • Here's a wierd one

    I'm writing a DOS batch file to fix a Service setting on a bunch of servers. The problem with this service is that reads a value in (Default) if it's set which I don't want. Here's my problem.

    Create a key with RegEdit called HKLM\Software\Test

    Result:
    HKLM\Software\Test
     (default) REG_SZ (value not set)

    Create a key from DOS with REG ADD HKLM\Software\Test

    Result:
    HKLM\Software\Test
     (default) REG_SZ
    notice the value is blank not (value not set)

    Now it should be the same thing except the service is reading the blank value as an entry. Anyway to get REG ADD to create the registry entry properly so the data value is set to (value not set) as it is when you create the key with RegEdit? I've tried the /ve switch but still creates a (default) key with a blank data value which doesn't really seem to be a null value

    Thursday, February 03, 2011 5:25 PM

Answers

  • Never mind, found the answer

    RegEdit to Create HKLM\SOFTWARE\TEST
    Result:
    [HKEY_LOCAL_MACHINE\SOFTWARE\TEST]

    REG ADD HKLM\SOFTWARE\TEST /f
    Result:
    [HKEY_LOCAL_MACHINE\SOFTWARE\TEST]
    @=""

    REG ADD HKLM\SOFTWARE\TEST
    REG DELETE HKLM\SOFTWARE\TEST /v "" /f
    Result:
    [HKEY_LOCAL_MACHINE\SOFTWARE\TEST]

    Thursday, February 03, 2011 7:24 PM