Registry changes apparently successful, but NO changes actually made!


  1. Posts : 95
    Windows 7 Professional 64-bit
       #1

    Registry changes apparently successful, but NO changes actually made!


    This is a nasty and incomprehensible problem I've had with two 64-bit Windows 7 SP1 on two separate machines: When I make command-line registry changes, even though no error is thrown, often the changes do NOT actually show up!

    I can make changes just fine with any GUI reg editor such as with Regedit or my preferred registry editor, Registrar Registry Manager 7.6 Pro. It's ONLY when I try to do this with a command line that it so often fails.

    Here are some examples that usually fail to actually change anything:

    Contents of C:\ChangeReg.reg:

    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_CURRENT_USER\Software\ACD Systems\ACDSee Pro\70]
    "DBFile"="C:\\Users\\All Users\\AppData\\Local\\ACD Systems\\Catalogs\\70Pro\\Default.dbin"
    Contents of Change01.bat:

    Code:
    NirCmd ElevateCmd RunAsSystem C:\Windows\RegEdit.exe /S "C:\ChangeReg.reg"
    IF %ERRORLEVEL% NEQ 0 GOTO :OOPS
    Echo "Successfully changed"
    GOTO :DONE
    :OOPS
    Echo "Regedit FAILED"
    :DONE
    Pause

    Contents of Change02.bat:

    Code:
    C:\Windows\System32\reg.exe IMPORT "C:\ChangeReg.reg"
    IF %ERRORLEVEL% NEQ 0 GOTO :OOPS
    Echo "Successfully changed"
    GOTO :DONE
    :OOPS
    Echo "Reg FAILED"
    :DONE
    Pause
    Contents of Change03.bat:

    Code:
    C:\Windows\System32\reg.exe IMPORT "C:\ChangeReg.reg" /reg:64
    IF %ERRORLEVEL% NEQ 0 GOTO :OOPS
    Echo "Successfully changed"
    GOTO :DONE
    :OOPS
    Echo "Reg FAILED"
    :DONE
    Pause

    Contents of Change04.bat:

    Code:
    C:\Windows\System32\reg.exe ADD "HKEY_CURRENT_USER\Software\ACD Systems\ACDSee Pro\70" /v DBFile /t REG_SZ /d "C:\Users\All Users\AppData\Local\ACD Systems\Catalogs\70Pro\Default.dbin" /f
    IF %ERRORLEVEL% NEQ 0 GOTO :OOPS
    Echo "Successfully changed"
    GOTO :DONE
    :OOPS
    Echo "Reg FAILED"
    :DONE
    Pause
    Not a single one of those batch files works! The "FAILED" messages NEVER appear, yet the registry entries remain unchanged.


    What's going on? What am I doing wrong?

    Thanks!
      My Computer


  2. Posts : 95
    Windows 7 Professional 64-bit
    Thread Starter
       #2

    I solved it myself!


    I've been looking for an answer to this riddle for well over a year, but after all that time spent googling and reading and googling and reading, I finally found the answer!

    What needs to be done is to include the following command after any of the Reg commands, as seen in any of the last three batch file examples I provided in my OP:

    Code:
    rundll32.exe USER32.DLL,UpdatePerUserSystemParameters ,1 ,True

    What that does is to force the system to update the registry changes in HKEY_CURRENT_USER without having to reboot or log-off/log-on again. How I wish someone had told me that!!

    (By the way, even that doesn't work with the 'Change01.bat' example, so to hell with doing it that way!)

    Of course, you don't need to issue that command after every Reg command that alters anything in the HKU path, but only after you've finished making such changes in the batch file in question.

    In the past, using XP Pro, I always used Reg commands to alter the registry in batch files, and it always worked correctly. But when I tried it under 64-bit Windows 7 Pro SP1, I kept getting the problem described in my OP. But now that I know the secret 'trick', things are looking up again!
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 14:04.
Find Us