Global Characters to Delete Registry keys with a .reg file

Ee 1 Reputation point
2022-06-19T04:25:35.353+00:00
  I have a bug that I have had in every computer i have owned for over 15 years.  It involves the registry and I have been fixing it manually for over a decade. I have to fix it about once every few weeks. I want to write a .reg file to do it instead of me going into regedit and doing it manuall. The problem is that i need to know how to delete HUNDREDS of copied registry keys when the name is a duplicate of an existing name. The duplicate names all have a digit (or 6) and a + sign after the original name. This seems ot occur because the first key gets filled up to the 255 charcter limit.   

Can i use global characters in a .reg file to delete these data keys?
I have literaly THOUSANDS (most i ever saw was over 25,000 ) of them to delete and NO WAY to know how many without going in and looking manually.

BTW i have no idea what the "tags" below mean, sorry

Windows for business Windows Client for IT Pros User experience Other
0 comments No comments
{count} votes

7 answers

Sort by: Most helpful
  1. MotoX80 36,291 Reputation points
    2022-06-22T20:41:31.86+00:00

    Just update that one value. Put this in a .bat file.

    reg.exe add "HKEY_CURRENT_USER\Software\SolidWorks\SolidWorks 2017\ExtReferences" /v "SolidWorks Journal Folders" /t REG_SZ /d "%LOCALAPPDATA%\Roaming\SOLIDWORKS\SOLIDWORKS 2017"   /f  
    

  2. MotoX80 36,291 Reputation points
    2022-06-26T12:50:16.917+00:00

    You don't need "190,000 lines of text in a reg file" just to update the one value where you are getting the redundant CURRENT_USER text. That one line to call reg.exe will set the value to the correct folder. The %LOCALAPPDATA% environment variable will expand to your account's folder. Change the folder name if you want a different folder.

    Create a new text file on your desktop and name it FixJournal.bat. Edit it with notepad and add these statements.

    cd \  
    cls  
    @echo.  
    @echo Setting the journal folder location.   
    set journal=%LOCALAPPDATA%\Roaming\SOLIDWORKS\SOLIDWORKS 2017  
    @echo.  
    @echo Creating the directory if it doesn't exist.  
    md "%journal%"  
    @echo.  
    @echo Updating the registry.   
    reg.exe add "HKEY_CURRENT_USER\Software\SolidWorks\SolidWorks 2017\ExtReferences" /v "SolidWorks Journal Folders" /t REG_SZ /d "%journal%"   /f  
    @echo.  
    @echo Folder contents.   
    dir "%journal%"  
    pause   
    

    Double click on the file to execute it.

    Create a second file named ShowJournal.bat.

    cd \  
    cls  
    @echo.  
    set journal=%LOCALAPPDATA%\Roaming\SOLIDWORKS\SOLIDWORKS 2017  
    @echo Show the registry.   
    reg.exe query "HKEY_CURRENT_USER\Software\SolidWorks\SolidWorks 2017\ExtReferences" /v "SolidWorks Journal Folders"  
    @echo.  
    @echo Folder contents.   
    dir "%journal%"  
    pause   
    

    Then open the SolidWorks app. Then run the ShowJournal.bat file. Were any files created in the folder? Did the redundant CURRENT_USER value come back in the registry? Close the app and look again.

    I don't know how this app works or what triggers your bug. I would hope that it wouldn't try to modify that registry value if it contained a valid folder name and the folder existed on the file system.

    If the bat file fixes the registry, you can run it manually whenever you want or you can put it in startup or create a scheduled task to run it.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.